# Ueful actions and tips ###### tags: `github` Notes for couple useful actions and syntax. #### Skip CI base on latest commit message ``` jobs: main: name: Build and test runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" ``` #### Cancel previous uncompleted workflows ``` jobs: test: runs-on: ubuntu-latest steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} #- name: Run Tests # uses: actions/setup-node@v1 # run: node test.js # ... etc ``` #### Run job only if specific dir/file changed ``` on: push: paths: - 'name of changed file' ``` #### Reference ``` https://github.com/marketplace/actions/skip-based-on-commit-message https://github.com/styfle/cancel-workflow-action https://github.com/tj-actions/verify-changed-files https://github.community/t/is-it-possible-to-run-the-job-only-when-a-specific-file-changes/115484/6 ```