Skip to content

Commit 049c7df

Browse files
ci: use bundled gh CLI instead of peter-evans/create-pull-request
Per @cclauss / zizmor 'superfluous actions' audit, persist the rolling tracker PR with the gh CLI rather than a third-party action.
1 parent 5d6bd5a commit 049c7df

1 file changed

Lines changed: 31 additions & 19 deletions

File tree

.github/workflows/hacktoberfest_prep.yml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,39 @@ jobs:
6161
# `master` is a protected branch: direct pushes are rejected with
6262
# `GH006: Protected branch update failed ... Changes must be made through
6363
# a pull request`. So instead of committing straight to master, persist
64-
# the refreshed tracker by opening — or updating in place — a single
65-
# rolling pull request. Re-runs reuse the same branch, so at most one
66-
# open PR exists at any time.
64+
# the refreshed tracker on a single rolling branch and open — or, since
65+
# re-pushing the branch updates the existing PR in place, leave open — one
66+
# pull request. Uses the bundled `gh` CLI rather than a third-party
67+
# action (see zizmor's "superfluous actions" audit).
6768
- name: Open or update the tracker pull request
6869
if: github.event_name != 'push' && github.event_name != 'pull_request'
69-
uses: peter-evans/create-pull-request@v7
70-
with:
71-
add-paths: docs/hacktober_2026_prep.md
72-
branch: chore/hacktoberfest-2026-prep-refresh
73-
delete-branch: true
74-
commit-message: "chore: refresh Hacktoberfest 2026 prep tracker"
75-
title: "chore: refresh Hacktoberfest 2026 prep tracker"
76-
body: |
77-
Automated daily refresh of the Hacktoberfest 2026 open-PR cleanup
78-
tracker (`docs/hacktober_2026_prep.md`): ticks off any tracked pull
79-
request that has since been merged/closed and rewrites the
80-
**Automated statistics** section.
70+
env:
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
BRANCH: chore/hacktoberfest-2026-prep-refresh
73+
run: |
74+
set -euo pipefail
75+
if git diff --quiet -- docs/hacktober_2026_prep.md; then
76+
echo "No changes to docs/hacktober_2026_prep.md; nothing to persist."
77+
exit 0
78+
fi
79+
git config --global user.name "$GITHUB_ACTOR"
80+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
81+
git switch -c "$BRANCH"
82+
git add docs/hacktober_2026_prep.md
83+
git commit -m "chore: refresh Hacktoberfest 2026 prep tracker"
84+
# Force-push so the rolling branch always carries just the latest
85+
# snapshot on top of master; this also updates any open PR in place.
86+
git push --force origin "$BRANCH"
87+
if [ -z "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then
88+
gh pr create \
89+
--base master \
90+
--head "$BRANCH" \
91+
--title "chore: refresh Hacktoberfest 2026 prep tracker" \
92+
--body "Automated daily refresh of the Hacktoberfest 2026 open-PR cleanup tracker (\`docs/hacktober_2026_prep.md\`): ticks off any tracked pull request that has since been merged/closed and rewrites the **Automated statistics** section.
8193
82-
This PR is updated in place by the `hacktoberfest_prep` workflow, so
83-
it always reflects the latest scheduled run. Merge it whenever you
84-
want to capture the current snapshot; a fresh one opens on the next
85-
run if there are new changes.
94+
This PR is updated in place by the \`hacktoberfest_prep\` workflow, so it always reflects the latest scheduled run. Merge it whenever you want to capture the current snapshot."
95+
else
96+
echo "Open tracker PR already exists; force-push updated it in place."
97+
fi
8698
- name: Propagate the script's exit code
8799
run: exit ${{ steps.update.outputs.exit_code }}

0 commit comments

Comments
 (0)