Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 6758c2a

Browse files
didrocksfkorotkov
authored andcommitted
Fix job condition (#23)
* Only run job on PR comment This prevent rebase job from running on issue comment. * Prevent workflow to fail when condition isn't met If a comment isn't on a PR or doesn't match /rebase, the workflow would fail because no jobs meets the running condition. The given advice was to always have a no-op job running to prevent this.
1 parent fcdcde3 commit 6758c2a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@ name: Automatic Rebase
1818
jobs:
1919
rebase:
2020
name: Rebase
21-
if: contains(github.event.comment.body, '/rebase')
21+
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@master
2525
- name: Automatic Rebase
2626
uses: cirrus-actions/rebase@master
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
# https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250
30+
always_job:
31+
name: Aways run job
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Always run
35+
run: echo "This job is used to prevent the workflow to fail when all other jobs are skipped."
2936
```

0 commit comments

Comments
 (0)