Skip to content

Commit

Permalink
Merge pull request #147 from pllim/ci-skip-no-fail
Browse files Browse the repository at this point in the history
TST: Skip CI without fail
  • Loading branch information
pllim authored Jan 9, 2021
2 parents 17d0b9c + f0091c9 commit a0ab53b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@ jobs:
cancel_ci:
name: Mandatory checks before CI
runs-on: ubuntu-latest
outputs:
run_next: ${{ steps.skip_ci_step.outputs.run_next }}
steps:
# Base branch check should run whether we skip CI or not
- name: Check base branch
uses: pllim/action-check_pr_basebranch@main
with:
BASEBRANCH_NAME: master
- name: Failure means CI is skipped on purpose
- name: Check skip CI
uses: pllim/action-skip-ci@main
id: skip_ci_step
with:
NO_FAIL: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This should only run if we did not skip CI
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@ce17749
if: steps.skip_ci_step.outputs.run_next == 'true'
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -33,6 +38,7 @@ jobs:
pep_and_audit:
runs-on: ubuntu-latest
needs: cancel_ci
if: needs.cancel_ci.outputs.run_next == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -60,6 +66,7 @@ jobs:
link_check:
runs-on: ubuntu-latest
needs: cancel_ci
if: needs.cancel_ci.outputs.run_next == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ on:

jobs:
cancel_ci:
name: Failure means CI cancelled on purpose
name: Mandatory checks before CI
runs-on: ubuntu-latest
outputs:
run_next: ${{ steps.skip_ci_step.outputs.run_next }}
steps:
- name: Failure means CI is skipped on purpose
- name: Check skip CI
uses: pllim/action-skip-ci@main
id: skip_ci_step
with:
NO_FAIL: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This should only run if we did not skip CI
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@ce17749
if: steps.skip_ci_step.outputs.run_next == 'true'
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -38,6 +43,7 @@ jobs:
analyze:
name: Analyze
needs: cancel_ci
if: needs.cancel_ci.outputs.run_next == 'true'
runs-on: ubuntu-latest

strategy:
Expand Down

0 comments on commit a0ab53b

Please sign in to comment.