File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 push :
55 branches :
66 - ' **'
7- pull_request_target :
8- types : closed
9- branches : master
7+ # Use pull_request (not pull_request_target) to build-test docs on PRs targeting master.
8+ # When a PR is merged, only the 'push' event triggers deployment to gh-pages.
9+ # Using pull_request_target here previously caused a race condition: merging a PR fired
10+ # both 'push' and 'pull_request_target' simultaneously, producing two concurrent runs
11+ # that both tried to force-push to gh-pages. The loser would fail with:
12+ # "cannot lock ref 'refs/heads/gh-pages': is at <new-sha> but expected <old-sha>"
13+ # See: https://github.com/OPM/opm-python-documentation/actions/runs/21938360885
14+ pull_request :
15+ branches : [master]
1016 repository_dispatch :
1117 types : [docstrings_common_updated, docstrings_simulators_updated]
1218permissions :
6470
6571 # Dynamically determine which branches to build documentation for
6672 # This allows the workflow to work on forks that may not have all release branches
67- BRANCHES=$(../scripts/get_doc_branches.sh "${{ github.ref_name }}")
73+ # For pull_request events, github.ref_name is the merge ref (e.g. "21/merge"),
74+ # not a real branch. Use github.base_ref (the PR target branch, e.g. "master")
75+ # instead, falling back to github.ref_name for push/dispatch events where
76+ # github.base_ref is empty.
77+ BRANCHES=$(../scripts/get_doc_branches.sh "${{ github.base_ref || github.ref_name }}")
6878 echo "Building documentation for branches: $BRANCHES"
6979 poetry run sphinx-versioned -m master -b "$BRANCHES" --force --git-root ../../
7080 - name : Copy documentation to gh-pages
You can’t perform that action at this time.
0 commit comments