mirror of
https://github.com/0xMarcio/cve.git
synced 2026-10-27 16:51:03 +00:00
Dispatch the site build after every bot commit
Commits pushed with the workflow token raise no push event, so site.yml only ran on its 06:20 schedule and the site trailed the index by up to a day. workflow_dispatch is exempt from that rule, so each writer now triggers it after a successful push. The push retry rebased onto the fetched main and, on a conflict, left HEAD there; the next push then succeeded as a no-op and the run went green with its changes discarded. Abort the rebase and fail instead.
This commit is contained in:
1 parent
fc1595d0af
commit
3041d9b90e
8 files changed
+96
-8
No files matched your search
@@ -7,6 +7,7 @@ on:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
|
||||
concurrency:
|
||||
group: repository-updates
|
||||
@@ -38,6 +39,7 @@ jobs:
|
||||
python3 .github/getTrending.py --counts-only
|
||||
|
||||
- name: Check for changes and commit
|
||||
id: commit
|
||||
run: |
|
||||
git config user.name 'CVE-BOT'
|
||||
git config user.email '[email protected]'
|
||||
@@ -59,10 +61,19 @@ jobs:
|
||||
|
||||
for attempt in 1 2 3; do
|
||||
if git push origin HEAD:main; then
|
||||
echo "pushed=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
echo "Push rejected; replaying onto the current main (attempt $attempt)"
|
||||
git fetch --unshallow origin main 2>/dev/null || git fetch origin main
|
||||
git rebase FETCH_HEAD
|
||||
git rebase FETCH_HEAD || { git rebase --abort; exit 1; }
|
||||
done
|
||||
exit 1
|
||||
|
||||
# Commits pushed with the workflow token raise no push event, so site.yml
|
||||
# would otherwise wait for its daily schedule. Dispatching is exempt.
|
||||
- name: Rebuild and deploy the site
|
||||
if: steps.commit.outputs.pushed == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: gh workflow run site.yml --ref main
|
||||
Reference in new issue
Block a user