Skip to content

Fix gh-pages deploy race condition#21

Open
hakonhagland wants to merge 2 commits intoOPM:masterfrom
hakonhagland:fix_race_cond
Open

Fix gh-pages deploy race condition#21
hakonhagland wants to merge 2 commits intoOPM:masterfrom
hakonhagland:fix_race_cond

Conversation

@hakonhagland
Copy link
Collaborator

Replace pull_request_target with pull_request to prevent duplicate workflow runs when merging PRs to master.

Previously, merging a PR fired both 'push' and 'pull_request_target' simultaneously, causing two runs to race for the gh-pages force-push. The loser failed with a "cannot lock ref" error. With pull_request, only the push event deploys on merge, while PRs still get build-tested.

Replace pull_request_target with pull_request to prevent
duplicate workflow runs when merging PRs to master.

Previously, merging a PR fired both 'push' and
'pull_request_target' simultaneously, causing two runs to
race for the gh-pages force-push. The loser failed with a
"cannot lock ref" error. With pull_request, only the push
event deploys on merge, while PRs still get build-tested.
For pull_request events, github.ref_name resolves to the
merge ref (e.g. "21/merge") instead of a real branch name.
This caused sphinx-versioned to fail with:
  error: pathspec '21/merge' did not match any file(s)

Use github.base_ref (the PR target branch) for pull_request
events, falling back to github.ref_name for push events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant