Collection of reusable github actions
Reports web app build size changes between pull request and main branches.
dir- path to the build foldersha- commit sha, uses${{ github.sha }}as defaultlabel- custom label to distinguish multiple builds, uses"default"as default
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn build
- uses: superdispatch/actions/build-size/cache@v1
with:
dir: builddir- path to the build foldersha- commit sha, uses${{ github.event.pull_request.base.sha }}as defaultlabel- custom label to distinguish multiple builds, uses"default"as defaultpr- pull request number, uses${{ github.event.number }}as defaulttoken- github token, uses${{ github.token }}as default
on:
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn build
- uses: superdispatch/actions/build-size/report@v1.5.0
with:
dir: buildDeploys build preview to Netlify
dir- folder to deploypr- pull request number, uses${{ github.event.number }}as defaultalias- alias for deployment, usespreview-${pr}as defaulttoken- github token, uses${{ github.token }}as defaultnetlify-token- netlify tokennetlify-site-id- netlify site to deploy to
on:
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn build
- uses: superdispatch/actions/deploy-preview@v1.5.0
with:
dir: build
netlify-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}Removes workflow artifacts
token- github token, uses${{ github.token }}as defaultpattern- reg-exp pattern string to match an artifact name, uses".*"as defaultskip-recent- keep specified number of artifacts even if they are matching provided pattern
on:
schedule:
- cron: '0 1 * * *'
jobs:
prune-artifacts:
runs-on: ubuntu-latest
steps:
- uses: superdispatch/actions/prune-artifacts@v1.5.0
with:
skip-recent: 5
pattern: '^e2e-'Updates changed files if changes are detected.
dry-run- string, dry run commit and push commandscommand- string, a command that is run for checkingupdate-command- string, a command that is run if main command failsmessage- string, commit message when there is changes found. Defaults "chore: Updated snapshots changes."token- github token, uses${{ github.token }}as default
name: Tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: superdispatch/actions/update-snapshots@v1.5.0
with:
command: yarn test
update-command: yarn test -uLimit PRs per user see more details
- Install packages using
npm,yarnorpnpm - Caches whole
node_modulesdirectory - Skips installation step when lockfile cache is hit
- Automatically appends OS and Node version to the
cache-key
working-directory– the default working directorycache-key– an explicit key for restoring and saving the cache
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: superdispatch/actions/npm/install@v2
- run: npm testPassing cache-key
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [14, 16, 18]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: superdispatch/actions/npm/install@v2
with:
cache-key: ${{ github.sha }}-
- run: npm test- Disables
autocrlfingit config - Checks out repository
- Downloads required Node version (see
node-versionoption) - Installs packages (see superdispatch/actions/npm/install)
working-directory– the default working directorynode-version– Node version specifiercache-key– an explicit key for restoring and saving the cache
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [14, 16, 18]
os: [ubuntu-latest, windows-latest]
steps:
- uses: superdispatch/actions/setup-node-repo@v2
with:
node-version: ${{ matrix.node }}
- run: npm testPassing cache-key
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [14, 16, 18]
os: [ubuntu-latest, windows-latest]
steps:
- uses: superdispatch/actions/setup-node-repo@v2
with:
cache-key: ${{ github.sha }}-
node-version: ${{ matrix.node }}
- run: npm test