Skip to content

Commit e7cd925

Browse files
author
ranchodeluxe
committed
early exit
1 parent fd34775 commit e7cd925

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/pre-release.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010

1111
jobs:
1212
pre-release:
13-
if: github.event.pull_request.merged == true || github.ref == 'refs/heads/main'
13+
if: github.event.pull_request.merged == true
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -21,6 +21,33 @@ jobs:
2121
with:
2222
version: ${{ env.HELM_VERSION }}
2323

24+
- name: install github cli
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y gh
28+
29+
- name: check if 'release-apply' label exists
30+
id: check_label
31+
run: |
32+
PR_NUMBER=${{ github.event.pull_request.number }}
33+
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name')
34+
echo "Labels: $LABELS"
35+
if echo "$LABELS" | grep -q "release-apply"; then
36+
echo "Label 'release-apply' found."
37+
echo "release_apply=true" >>$GITHUB_OUTPUT
38+
else
39+
echo "Label 'release-apply' not found."
40+
echo "release_apply=false" >>$GITHUB_OUTPUT
41+
fi
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: early exit if release-apply is not present
46+
if: steps.check_label.outputs.release_apply == 'false'
47+
run: |
48+
echo "The pull request is merged and does not have the 'release-apply' label. Existing with success"
49+
exit 0
50+
2451
- name: determine version increment
2552
id: determine-version
2653
run: |

0 commit comments

Comments
 (0)