Skip to content
This repository was archived by the owner on Oct 31, 2026. It is now read-only.

Commit 2bb0205

Browse files
committed
apt-repo workflow: force-push when recreating gh-pages
A reset starts from an orphan commit, which can never fast-forward. Normal runs keep the safe plain push.
1 parent 0bc4378 commit 2bb0205

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎.github/workflows/apt-repo.yml‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ jobs:
130130
"$RUNNER_TEMP"/debs/*.deb
131131
132132
- name: Push gh-pages
133+
env:
134+
RESET_BRANCH: ${{ inputs.reset }}
133135
run: |
134136
cd "$RUNNER_TEMP/repo" || exit 1
135137
git add -A
@@ -138,6 +140,14 @@ jobs:
138140
exit 0
139141
fi
140142
git commit --quiet -m "apt-repo: publish $(date -u +%Y-%m-%d)"
141-
git push --quiet \
142-
"https://x-access-token:$GH_TOKEN@github.com/${{ github.repository }}.git" \
143-
"$PAGES_BRANCH"
143+
# A reset recreates the branch from an orphan commit, which is
144+
# never a fast-forward — force-push only in that mode.
145+
if [ "$RESET_BRANCH" = "true" ]; then
146+
git push --force --quiet \
147+
"https://x-access-token:$GH_TOKEN@github.com/${{ github.repository }}.git" \
148+
"$PAGES_BRANCH"
149+
else
150+
git push --quiet \
151+
"https://x-access-token:$GH_TOKEN@github.com/${{ github.repository }}.git" \
152+
"$PAGES_BRANCH"
153+
fi

0 commit comments

Comments
 (0)