Skip to content

Commit 1313d09

Browse files
authored
chore: trigger mirror-to-gh-pages action after release completed (#799)
* chore: trigger mirror-ro-gh-pages after release completed * leftover * fix: workflow run use case
1 parent f47e9b4 commit 1313d09

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/mirror-to-gh-pages.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Mirror latest release to GitHub Pages with LFS
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_run:
5+
workflows: ['Release']
6+
types: [completed]
7+
branches: [main]
68
workflow_dispatch:
79
inputs:
810
tag:
@@ -15,11 +17,18 @@ permissions:
1517
jobs:
1618
mirror:
1719
runs-on: ubuntu-latest
20+
# Only run if the triggering workflow succeeded (when triggered by workflow_run)
21+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
1822
steps:
1923
- name: Get release info
2024
id: release
2125
run: |
22-
TAG="${{ github.event.inputs.tag || github.event.release.tag_name }}"
26+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
27+
TAG="${{ github.event.inputs.tag }}"
28+
else
29+
# Get the latest release tag when triggered by workflow_run
30+
TAG=$(gh api "repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name')
31+
fi
2332
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
2433
2534
# Get release metadata

0 commit comments

Comments
 (0)