GeezerVison is showing github.com — ci · koji/opencode@2d3c7a0
File tree
Expand file treeCollapse file tree
Open diff view settings
actions/setup-git-committer
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +42Lines changed: 42 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +name: "Setup Git Committer" |
| 2 | +description: "Create app token and configure git user" |
| 3 | +inputs: |
| 4 | + opencode-app-id: |
| 5 | + description: "OpenCode GitHub App ID" |
| 6 | + required: true |
| 7 | + opencode-app-secret: |
| 8 | + description: "OpenCode GitHub App private key" |
| 9 | + required: true |
| 10 | +outputs: |
| 11 | + token: |
| 12 | + description: "GitHub App token" |
| 13 | + value: ${{ steps.app-token.outputs.token }} |
| 14 | + app-slug: |
| 15 | + description: "GitHub App slug" |
| 16 | + value: ${{ steps.app-token.outputs.app-slug }} |
| 17 | + user-id: |
| 18 | + description: "GitHub App user id" |
| 19 | + value: ${{ steps.get-user-id.outputs.user-id }} |
| 20 | +runs: |
| 21 | + using: "composite" |
| 22 | + steps: |
| 23 | + - name: Create app token |
| 24 | + id: app-token |
| 25 | + uses: actions/create-github-app-token@v2 |
| 26 | + with: |
| 27 | + app-id: ${{ inputs.opencode-app-id }} |
| 28 | + private-key: ${{ inputs.opencode-app-secret }} |
| 29 | + |
| 30 | + - name: Get GitHub App user id |
| 31 | + id: get-user-id |
| 32 | + run: | |
| 33 | + echo "user-id=$(gh api \"/users/${{ steps.app-token.outputs.app-slug }}[bot]\" --jq .id)" >> "$GITHUB_OUTPUT" |
| 34 | + shell: bash |
| 35 | + env: |
| 36 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 37 | + |
| 38 | + - name: Configure git user |
| 39 | + run: | |
| 40 | + git config --global user.name "${{ steps.app-token.outputs.app-slug }}[bot]" |
| 41 | + git config --global user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com" |
| 42 | + shell: bash |
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/generate.yml +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,17 +24,17 @@ jobs: |
24 | 24 | - name: Setup Bun |
25 | 25 | uses: ./.github/actions/setup-bun |
26 | 26 |
|
| 27 | + - name: Setup git committer |
| 28 | + uses: ./.github/actions/setup-git-committer |
| 29 | + with: |
| 30 | + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} |
| 31 | + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} |
| 32 | + |
27 | 33 | - name: Generate |
28 | 34 | run: ./script/generate.ts |
29 | 35 |
|
30 | 36 | - name: Commit and push |
31 | 37 | run: | |
32 | | - if [ -z "$(git status --porcelain)" ]; then |
33 | | - echo "No changes to commit" |
34 | | - exit 0 |
35 | | - fi |
36 | | - |
37 | | - git config --local user.name "GitHub Action" |
38 | 38 | git add -A |
39 | 39 | git commit -m "chore: generate" |
40 | 40 | git push origin HEAD:${{ github.ref_name }} --no-verify |
|