Skip to content

Commit c7e5702

Browse files
committed
ci: use the exit command instead
1 parent 3c39551 commit c7e5702

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

.github/workflows/auto-merge.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ jobs:
99
auto-merge:
1010
if: github.event.pull_request.user.login == 'dependabot[bot]' # Ensures this only runs for Dependabot PRs
1111
runs-on: ubuntu-latest
12-
env:
13-
JOB_ABORTED: 'false' # env var used to indicate whether job should be aborted
1412
steps:
1513
- name: Check if the PR has the 'dependencies' label
1614
uses: actions/github-script@v6
@@ -25,26 +23,23 @@ jobs:
2523
2624
if (!hasDependenciesLabel) {
2725
console.log("The 'dependencies' label is missing. Auto-merge aborted.");
28-
core.exportVariable('JOB_ABORTED', 'true');
26+
process.exit(0);
2927
}
3028
3129
- name: Fetch Dependabot metadata
32-
if: env.JOB_ABORTED == 'false'
3330
id: metadata
3431
uses: dependabot/fetch-metadata@v2
3532

3633
- name: Check if update is a minor or patch group or individual minor/patch update
37-
if: env.JOB_ABORTED == 'false'
3834
run: |
3935
if [[ "${{ steps.metadata.outputs.update-type }}" != *":semver-minor"* && \
4036
"${{ steps.metadata.outputs.update-type }}" != *":semver-patch"* && \
4137
"${{ github.event.pull_request.title }}" != *"minor-and-patch group"* ]]; then
4238
echo "This PR is not a minor or patch update. Auto-merge aborted."
43-
echo "JOB_ABORTED=true" >> $GITHUB_ENV
39+
exit 0
4440
fi
4541
4642
- name: Check if CI passed
47-
if: env.JOB_ABORTED == 'false'
4843
uses: actions/github-script@v6
4944
with:
5045
script: |
@@ -61,18 +56,16 @@ jobs:
6156
6257
if (!allStatusesSuccessful) {
6358
console.log("Not all CI checks passed. Auto-merge aborted.");
64-
core.exportVariable('JOB_ABORTED', 'true');
59+
process.exit(0);
6560
}
6661
6762
- name: Auto-Approve PR
68-
if: env.JOB_ABORTED == 'false'
6963
run: gh pr review --approve "$PR_URL"
7064
env:
7165
PR_URL: ${{github.event.pull_request.html_url}}
7266
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7367

7468
- name: Auto-Merge PR
75-
if: env.JOB_ABORTED == 'false'
7669
run: gh pr merge --squash --delete-branch "$PR_URL"
7770
env:
7871
PR_URL: ${{github.event.pull_request.html_url}}

0 commit comments

Comments
 (0)