mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
ci
This commit is contained in:
42
.github/actions/setup-git-committer/action.yml
vendored
Normal file
42
.github/actions/setup-git-committer/action.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: "Setup Git Committer"
|
||||
description: "Create app token and configure git user"
|
||||
inputs:
|
||||
opencode-app-id:
|
||||
description: "OpenCode GitHub App ID"
|
||||
required: true
|
||||
opencode-app-secret:
|
||||
description: "OpenCode GitHub App private key"
|
||||
required: true
|
||||
outputs:
|
||||
token:
|
||||
description: "GitHub App token"
|
||||
value: ${{ steps.app-token.outputs.token }}
|
||||
app-slug:
|
||||
description: "GitHub App slug"
|
||||
value: ${{ steps.app-token.outputs.app-slug }}
|
||||
user-id:
|
||||
description: "GitHub App user id"
|
||||
value: ${{ steps.get-user-id.outputs.user-id }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Create app token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ inputs.opencode-app-id }}
|
||||
private-key: ${{ inputs.opencode-app-secret }}
|
||||
|
||||
- name: Get GitHub App user id
|
||||
id: get-user-id
|
||||
run: |
|
||||
echo "user-id=$(gh api \"/users/${{ steps.app-token.outputs.app-slug }}[bot]\" --jq .id)" >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
- name: Configure git user
|
||||
run: |
|
||||
git config --global user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
|
||||
git config --global user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
|
||||
shell: bash
|
||||
12
.github/workflows/generate.yml
vendored
12
.github/workflows/generate.yml
vendored
@@ -24,17 +24,17 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
|
||||
- name: Setup git committer
|
||||
uses: ./.github/actions/setup-git-committer
|
||||
with:
|
||||
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
||||
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
||||
|
||||
- name: Generate
|
||||
run: ./script/generate.ts
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
echo "No changes to commit"
|
||||
exit 0
|
||||
fi
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add -A
|
||||
git commit -m "chore: generate"
|
||||
git push origin HEAD:${{ github.ref_name }} --no-verify
|
||||
|
||||
Reference in New Issue
Block a user