diff --git a/.github/workflows/update-workflows.yml b/.github/workflows/update-workflows.yml new file mode 100644 index 0000000..5a10f3b --- /dev/null +++ b/.github/workflows/update-workflows.yml @@ -0,0 +1,79 @@ +name: "Update Agentic Workflows" + +# This workflow automatically updates and compiles agentic workflows +on: + schedule: + - cron: "23 0 * * 0" # Run weekly on Sunday at 00:23 UTC + workflow_dispatch: # Allow manual trigger + push: + paths: + - .github/workflows/update-workflows.yml + +jobs: + update-workflows: + runs-on: ubuntu-latest + + permissions: + contents: write # Need write permission to commit changes + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install gh-aw extension + run: | + curl -fsSL https://raw.githubusercontent.com/githubnext/gh-aw/refs/heads/main/install-gh-aw.sh | bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Verify gh-aw installation + run: gh aw version + + - name: Run gh aw init + run: gh aw init + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run gh aw compile + run: gh aw compile + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check for changes + id: check_changes + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "changes=true" >> $GITHUB_OUTPUT + echo "Changes detected:" + git status --short + else + echo "changes=false" >> $GITHUB_OUTPUT + echo "No changes detected" + fi + + - name: Commit and push changes + if: steps.check_changes.outputs.changes == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "chore: update agentic workflows + + - Ran gh aw init + - Ran gh aw compile + - Auto-generated by update-workflows action" + git push + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Summary + run: | + echo "## Workflow Update Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + if [[ "${{ steps.check_changes.outputs.changes }}" == "true" ]]; then + echo "✅ Changes were detected and committed" >> $GITHUB_STEP_SUMMARY + else + echo "ℹ️ No changes were detected" >> $GITHUB_STEP_SUMMARY + fi