Skip to content

Latest commit

 

History

History
75 lines (58 loc) · 2.51 KB

README.md

File metadata and controls

75 lines (58 loc) · 2.51 KB

Brads Github Actions

.github/workflows/main.yml semantic-release Conventional Commits KeepAChangelog NodeJs TypeScript

A collection of Github Actions. https://github.com/features/actions

Cancel Redundant

This action will use the Github Workflow API to cancel all queued and in progress jobs for the current branch or PR.

Influenced by:

jobs:
  init:
    if: "! contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    steps:
      - uses: brad-jones/actions/cancel-redundant@v1.0.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

Now just make all your other jobs depend on init and they will a) be canceled if a newer commit is pushed and b) they will never run if the ubiquitous [skip ci] text in included in your commit message.

NOTE: The GITHUB_TOKEN provided for PRs will not have enough permissions to cancel jobs. So if you want this to work for PRs you would need to setup a second token that has the repo & workflow scopes.

Search Replace File

This is a simple wrapper for the https://www.npmjs.com/package/replace-in-file module.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: brad-jones/actions/search-replace-file@v1.0.0
        with:
          files: ./version.js
          from: /commit-sha-goes-here/
          to: ${{ github.sha }}
  • files: should be a valid glob file path.
  • from: is expected to be a Regular Expression
  • to: the text to use as the replacement for all matches

Setup Dart

Installs the dartlang SDK https://dart.dev

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: brad-jones/actions/setup-dart@v1.0.0
        with:
          version: 2.7.1
  • version: is optional and will default to the latest stable release