Skip to content

Commit

Permalink
fix(workflows): replace should-skip determination algo
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Jan 3, 2021
1 parent 990d1e1 commit cd6236a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ env:
CI_COMMITTER_NAME: xunn-bot
CI_COMMITTER_EMAIL: bot@xunn.io
# ! These also have to be updated in .changelogrc.js and cleanup.yml
CI_SKIP_COMMANDS: '[skip ci], [ci skip]'
CI_SKIP_REGEX: '\[skip ci\]|\[ci skip\]'
# ? Add your GitHub user/org to enable CD pipeline
# ? (you'll need to provide your own secrets or the pipeline will error)
REPO_OWNER_WHITELIST: xunnamius, ergodark, nhscc
Expand Down Expand Up @@ -83,6 +83,12 @@ jobs:
- name: Determine should-skip
id: skip-ci
run: |
# Get last commit message
LAST_COMMIT_MSG=$(git log -1 --pretty=format:"%s")
! [ -z "$DEBUG" ] && echo "LAST_COMMIT_MSG=$LAST_COMMIT_MSG"
echo "$LAST_COMMIT_MSG" | grep -qE "$CI_SKIP_REGEX"
[ $? -ne 0 ] && CI_SKIP=false || CI_SKIP=true
! [ -z "$DEBUG" ] && echo "CI_SKIP=$CI_SKIP"
echo "::set-output name=should-skip::$CI_SKIP"
! [ -z "$DEBUG" ] && echo "set-output name=should-skip::$CI_SKIP" || true
Expand Down Expand Up @@ -249,7 +255,7 @@ jobs:
uses: actions/checkout@v2
with:
# ? codecov-action requires access to git history
fetch-depth: 0 #1000 https://github.com/mstachniuk/ci-skip#use-cases
fetch-depth: 0
persist-credentials: false

- name: Reconfigure git auth
Expand Down Expand Up @@ -553,7 +559,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 #1000 https://github.com/mstachniuk/ci-skip#use-cases
fetch-depth: 0
persist-credentials: false

- name: Reconfigure git auth
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ jobs:
with:
fetch-depth: 1 # ! We only skip if the tippy top commit says so!

- name: Gather CI metadata
uses: mstachniuk/ci-skip@v1.2.0
with:
commit-filter: ${{ env.CI_SKIP_COMMANDS }}
commit-filter-separator: ', '
- name: Determine should-skip
id: skip-ci
run: |
# Get last commit message
LAST_COMMIT_MSG=$(git log -1 --pretty=format:"%s")
! [ -z "$DEBUG" ] && echo "LAST_COMMIT_MSG=$LAST_COMMIT_MSG"
echo "$LAST_COMMIT_MSG" | grep -qE "$CI_SKIP_REGEX"
[ $? -ne 0 ] && CI_SKIP=false || CI_SKIP=true
! [ -z "$DEBUG" ] && echo "CI_SKIP=$CI_SKIP"
echo "::set-output name=should-skip::$CI_SKIP"
! [ -z "$DEBUG" ] && echo "set-output name=should-skip::$CI_SKIP" || true
- name: Determine should-skip
id: skip-ci
Expand Down

0 comments on commit cd6236a

Please sign in to comment.