Skip to content

Commit

Permalink
Now GH actions support skip ci officially (#4579)
Browse files Browse the repository at this point in the history
  • Loading branch information
outsideris authored Mar 5, 2021
1 parent 8d6d1e3 commit e29c2f4
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,16 @@ name: Tests
- reopened

jobs:
prepare-commit-msg:
name: Retrieve head commit message
prevent-run-twice:
name: Prevent to run twice
runs-on: ubuntu-latest
# Run 'pull-request' event only on external PRs from forked repos.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
outputs:
HEAD_COMMIT_MSG: '${{ steps.commitMsg.outputs.HEAD_COMMIT_MSG }}'
steps:
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
- name: find commit msg for PR
id: commitMsg
if: github.event_name == 'pull_request'
run: >-
echo "::set-output name=HEAD_COMMIT_MSG::$(git log --no-merges -1
--oneline)"
check-skip:
name: Check to skip CI
needs: prepare-commit-msg
runs-on: ubuntu-latest
if: >-
${{ !contains(github.event.head_commit.message, '[ci skip]') &&
!contains(needs.prepare-commit-msg.outputs.HEAD_COMMIT_MSG, '[ci skip]')
}}
steps:
- run: 'echo "${{ github.event.head_commit.message }}"'

- run: 'echo run Tests'
smoke:
name: 'Smoke [Node.js v${{ matrix.node }} / ${{ matrix.os }}]'
needs: check-skip
needs: prevent-run-twice
runs-on: '${{ matrix.os }}'
strategy:
matrix:
Expand Down

0 comments on commit e29c2f4

Please sign in to comment.