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