Skip to content

Commit 54e9e38

Browse files
authored
Onboard action recompile_aw (#13)
1 parent 94b17b3 commit 54e9e38

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'Recompile Agentic Workflows'
2+
3+
on:
4+
push:
5+
paths:
6+
- '.github/workflows/*.md'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
11+
jobs:
12+
recompile:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
actions: read
17+
steps:
18+
- uses: actions/checkout@v6.0.2
19+
- env:
20+
GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
21+
run: |
22+
gh extension install github/gh-aw
23+
gh aw compile
24+
- id: push
25+
run: |
26+
if git diff --quiet HEAD; then exit 0; fi
27+
user_name="$(gh api user --jq .login)"
28+
user_id="$(gh api user --jq .id)"
29+
git config user.name "$user_name"
30+
git config user.email "${user_id}+${user_name}@users.noreply.github.com"
31+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
32+
git add -A
33+
git commit -m "recompile agentic workflows"
34+
git push && echo "pushed=true" >> "$GITHUB_OUTPUT" || echo "pushed=false" >> "$GITHUB_OUTPUT"
35+
env:
36+
GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
37+
- if: steps.push.outputs.pushed == 'false'
38+
id: open-pr
39+
uses: peter-evans/create-pull-request@v8.1.0
40+
with:
41+
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
42+
commit-message: "recompile agentic workflows"
43+
base: main
44+
branch: "agentic-workflows/auto-recompile"
45+
title: "Recompile Agentic Workflows"
46+
body: |
47+
(this PR is automatically generated)
48+
delete-branch: true
49+
- if: steps.open-pr.outputs.pull-request-number != null
50+
run: sleep 60 # make sure PR state is updated and API can catch up
51+
- if: steps.open-pr.outputs.pull-request-number != null
52+
shell: bash
53+
run: gh pr merge --squash --auto ${{ steps.open-pr.outputs.pull-request-number }}
54+
env:
55+
GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
56+
continue-on-error: true

0 commit comments

Comments
 (0)