Skip to content

Commit 0d82e01

Browse files
committed
Only run release build when PR has certain label
1 parent 48a7827 commit 0d82e01

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/release.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,27 @@ on:
1414
- cron: '0 0 * * *'
1515
workflow_dispatch:
1616

17+
env:
18+
BUILD_LABEL: "run release build"
19+
1720
jobs:
21+
check-pr-labels:
22+
name: check PR labels
23+
runs-on: ubuntu-latest
24+
outputs:
25+
run_release_workflow: ${{ steps.gen_output.outputs.apt_tools }}
26+
steps:
27+
- if: ${{ github.event_name == 'pull_request' }}
28+
run: |
29+
echo run_release_workflow="$(if gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep --quiet '^${{ env.BUILD_LABEL }}$' ; then echo "yes" ; else echo "no")" >> "$GITHUB_OUTPUT"
30+
31+
- if: ${{ github.event_name != 'pull_request' }}
32+
run: |
33+
echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
34+
1835
release-workflow:
36+
needs: ["check-pr-labels"]
37+
if: ${{ needs.check-pr-labels.outputs.run_release_workflow == 'yes' }}
1938
uses: ./.github/workflows/reusable-release.yml
2039
with:
2140
branches: '["${{ github.ref }}"]'

0 commit comments

Comments
 (0)