mirror of
https://github.com/imjasonh/git-k8s
synced 2026-07-09 23:27:01 +00:00
The workflows: write permission in the YAML permissions block is not valid for GITHUB_TOKEN, which prevented the workflow from starting. Pushing files under .github/workflows/ requires a PAT with the workflows scope. The workflow now uses a GH_PAT secret (falling back to GITHUB_TOKEN) for checkout and push. To set this up: Create a fine-grained PAT with Contents + Workflows read/write, then: gh secret set GH_PAT --body "<your-pat>" https://claude.ai/code/session_01JTYNSeJrGzdW6wfAUbdjjw
58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
name: Compile Agentic Workflows
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ["main"]
|
|
paths:
|
|
- ".github/workflows/*.md"
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- ".github/workflows/*.md"
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
compile:
|
|
name: Compile
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout (push)
|
|
if: github.event_name == 'push'
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# A PAT with workflows scope is required to push .lock.yml
|
|
# files under .github/workflows/.
|
|
token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Checkout (PR head branch)
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install gh-aw extension
|
|
run: gh extension install github/gh-aw
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_PAT || github.token }}
|
|
|
|
- name: Compile all agentic workflows
|
|
run: gh aw compile .github/workflows/*.md
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_PAT || github.token }}
|
|
|
|
- name: Commit and push lock files if changed
|
|
run: |
|
|
git add .github/workflows/*.lock.yml || true
|
|
if git diff --cached --quiet; then
|
|
echo "Lock files are up to date."
|
|
else
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git commit -m "Recompile agentic workflow lock files"
|
|
git push
|
|
fi
|