GitHub Actions
Docs:
Example workflows
On push
yml
name: learn-github-actionson: [push]jobs:check-bats-version:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v2- uses: actions/setup-node@v1- run: npm install -g bats- run: bats -v
PRs only
yml
name: Run on PR'on': pull_requestjobs:build_and_preview:runs-on: ubuntu-lateststeps:- name: Checkout codeuses: actions/checkout@v2- name: Get yarn cache directory pathid: yarn-cache-dir-pathrun: echo "::set-output name=dir::$(yarn cache dir)"- uses: actions/cache@v2id: yarn-cachewith:path: ${{ steps.yarn-cache-dir-path.outputs.dir }}key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}restore-keys: |${{ runner.os }}-yarn-- name: Install dependenciesrun: yarn --prefer-offline- name: bundlephobia-checker# https://github.com/carlesnunez/check-my-bundlephobiauses: carlesnunez/check-my-bundlephobia@v1.8.0with:repo-token: ${{ secrets.GITHUB_TOKEN }}strict: truethreshold: 800ignore-dev-dependencies: true- name: Lintrun: yarn lint- name: Testrun: yarn test- name: Build apprun: yarn build
On merge into main
branch
yml
name: Run on merge'on':push:branches:- mainjobs:build_and_deploy:runs-on: ubuntu-lateststeps:- name: Checkout codeuses: actions/checkout@v2- name: Get yarn cache directory pathid: yarn-cache-dir-pathrun: echo "::set-output name=dir::$(yarn cache dir)"- uses: actions/cache@v2id: yarn-cachewith:path: ${{ steps.yarn-cache-dir-path.outputs.dir }}key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}restore-keys: |${{ runner.os }}-yarn-- name: Install dependenciesrun: yarn --prefer-offline- name: Lintrun: yarn lint- name: Testrun: yarn test- name: Build apprun: yarn build- name: Build Storybookrun: yarn storybook:build
Enable debug logging
Set either/both in your repo's secrets:
ACTIONS_STEP_DEBUG=true
ACTIONS_RUNNER_DEBUG=true