File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ name: Build and release
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - master
7
5
tags :
8
6
- ' v*'
9
7
- ' cabal-install-*'
14
12
- cron : ' 0 0 * * *'
15
13
workflow_dispatch :
16
14
15
+ permissions :
16
+ pull-requests : read
17
+
18
+ env :
19
+ BUILD_LABEL : " run release build"
20
+
17
21
jobs :
22
+ check-pr-labels :
23
+ name : check PR labels
24
+ runs-on : ubuntu-latest
25
+ outputs :
26
+ run_release_workflow : ${{ steps.gen_output.outputs.run_release_workflow }}
27
+ steps :
28
+ - id : gen_output
29
+ run : |
30
+ if [ "${{ github.event_name }}" = 'pull_request' ] ; then
31
+ 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)
32
+ echo "${run_it}"
33
+ echo run_release_workflow="${run_it}" >> "$GITHUB_OUTPUT"
34
+ else
35
+ echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
36
+ fi
37
+ shell : bash
38
+ env :
39
+ GH_TOKEN : ${{ github.token }}
40
+
18
41
release-workflow :
42
+ needs : ["check-pr-labels"]
43
+ if : ${{ needs.check-pr-labels.outputs.run_release_workflow == 'yes' }}
19
44
uses : ./.github/workflows/reusable-release.yml
20
45
with :
21
46
branches : ' ["${{ github.ref }}"]'
You can’t perform that action at this time.
0 commit comments