Skip to content

Commit 6032e41

Browse files
committed
ci: commit verified demo assets on same-repo PRs
1 parent 747b120 commit 6032e41

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/demo-assets.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ on:
99
workflow_dispatch:
1010

1111
permissions:
12-
contents: read
12+
contents: write
1313

1414
jobs:
1515
capture:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 15
1818
steps:
19-
- name: Checkout
19+
- name: Checkout source branch
2020
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.head_ref || github.ref_name }}
2123

2224
- name: Setup Python
2325
uses: actions/setup-python@v5
@@ -84,6 +86,22 @@ jobs:
8486
if-no-files-found: error
8587
retention-days: 14
8688

89+
- name: Commit verified assets to source branch
90+
if: >-
91+
github.event_name == 'pull_request' &&
92+
github.event.pull_request.head.repo.full_name == github.repository &&
93+
github.actor != 'github-actions[bot]'
94+
run: |
95+
git config user.name "github-actions[bot]"
96+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
97+
git add assets/demo/safe-agent-playground.png assets/demo/safe-agent-demo.gif
98+
if git diff --cached --quiet; then
99+
echo "Verified assets are unchanged."
100+
exit 0
101+
fi
102+
git commit -m "docs: refresh verified demo assets"
103+
git push origin "HEAD:${GITHUB_HEAD_REF}"
104+
87105
- name: Show API logs on failure
88106
if: failure()
89107
run: cat /tmp/safe-agent-api.log || true

0 commit comments

Comments
 (0)