@@ -88,17 +88,46 @@ jobs:
8888 name : Skip Release Branch Wiki Publish
8989 if : github.event_name == 'pull_request_target' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && startsWith(github.event.pull_request.head.ref, inputs.release-branch-prefix)
9090 runs-on : ubuntu-latest
91+ permissions :
92+ contents : write
93+
94+ env :
95+ WIKI_PREVIEW_BRANCH : pr-${{ github.event.pull_request.number }}
9196
9297 steps :
98+ - name : Checkout main branch
99+ uses : actions/checkout@v6
100+ with :
101+ token : ${{ github.token }}
102+ ref : main
103+ submodules : recursive
104+ fetch-depth : 0
105+
106+ - name : Mark wiki workspace as safe for git
107+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE/.github/wiki"
108+
109+ - name : Delete wiki preview branch
110+ id : cleanup_preview
111+ working-directory : .github/wiki
112+ run : |
113+ if git ls-remote --exit-code --heads origin "${WIKI_PREVIEW_BRANCH}" >/dev/null 2>&1; then
114+ git push origin --delete "${WIKI_PREVIEW_BRANCH}"
115+ echo "deleted=true" >> "$GITHUB_OUTPUT"
116+ else
117+ echo "deleted=false" >> "$GITHUB_OUTPUT"
118+ fi
119+
93120 - name : Explain release publish handling
94121 env :
95122 RELEASE_BRANCH : ${{ github.event.pull_request.head.ref }}
96123 run : |
97124 {
98125 printf '## Wiki Publish Summary\n\n'
99126 printf -- '- Publish branch: `master`\n'
127+ printf -- '- Preview branch: `%s`\n' "${WIKI_PREVIEW_BRANCH}"
100128 printf -- '- Release branch: `%s`\n' "$RELEASE_BRANCH"
101129 printf -- '- Action: skipped preview-branch publication because merged release branches are refreshed from the authoritative released state by `changelog.yml`.\n'
130+ printf -- '- Preview cleanup: `%s`\n' "${{ steps.cleanup_preview.outputs.deleted == 'true' && 'deleted immediately' || 'not present' }}"
102131 } >> "$GITHUB_STEP_SUMMARY"
103132
104133 cleanup_closed_preview :
0 commit comments