File tree Expand file tree Collapse file tree 1 file changed +34
-2
lines changed Expand file tree Collapse file tree 1 file changed +34
-2
lines changed Original file line number Diff line number Diff line change 66 - ' v*'
77 - ' cabal-install-*'
88 pull_request :
9- types : [ labeled ]
9+ types : [opened, synchronize, reopened, labeled ]
1010 branches :
1111 - master
1212 schedule :
1313 - cron : ' 0 0 * * *'
1414 workflow_dispatch :
1515
16+ permissions :
17+ pull-requests : read
18+
19+ env :
20+ BUILD_LABEL : " run release build"
21+
1622jobs :
23+ check-pr-labels :
24+ name : check PR labels
25+ runs-on : ubuntu-latest
26+ outputs :
27+ run_release_workflow : ${{ steps.gen_output.outputs.run_release_workflow }}
28+ steps :
29+ - id : gen_output
30+ run : |
31+ if [ "${{ github.event.action }}" == 'labeled' ] ; then
32+ if [ ${{ github.event.label.name == '${{ env.BUILD_LABEL }}' }} ] ; then
33+ echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
34+ else
35+ echo run_release_workflow="no" >> "$GITHUB_OUTPUT"
36+ fi
37+ elif [ "${{ github.event_name }}" = 'pull_request' ] ; then
38+ run_it=$(if gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep --quiet '^${{ env.BUILD_LABEL }}$' ; then printf "%s" "yes" ; else printf "%s" "no" ; fi)
39+ echo "${run_it}"
40+ echo run_release_workflow="${run_it}" >> "$GITHUB_OUTPUT"
41+ else
42+ echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
43+ fi
44+ shell : bash
45+ env :
46+ GH_TOKEN : ${{ github.token }}
47+
1748 release-workflow :
18- if : ${{ github.event.label.name == 'run release build' }}
49+ needs : ["check-pr-labels"]
50+ if : ${{ needs.check-pr-labels.outputs.run_release_workflow == 'yes' }}
1951 uses : ./.github/workflows/reusable-release.yml
2052 with :
2153 branches : ' ["${{ github.ref }}"]'
You can’t perform that action at this time.
0 commit comments