Skip to content

Commit 1394b55

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

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/release.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,25 @@ 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+
outputs:
23+
run_release_workflow: ${{ steps.gen_output.outputs.apt_tools }}
24+
steps:
25+
- if: ${{ github.event_name == 'pull_request' }}
26+
run: |
27+
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"
28+
29+
- if: ${{ github.event_name != 'pull_request' }}
30+
run: |
31+
echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
32+
1833
release-workflow:
34+
needs: ["check-pr-labels"]
35+
if: ${{ needs.check-pr-labels.outputs.run_release_workflow == 'yes' }}
1936
uses: ./.github/workflows/reusable-release.yml
2037
with:
2138
branches: '["${{ github.ref }}"]'

0 commit comments

Comments
 (0)