name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  lint:
    name: Lint
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Run shellcheck
        run: |
          shellcheck bin/dotfiles

  test:
    name: Test
    needs:
      - lint
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Install dotfiles
        env:
          DOTFILES_PATH: ${{ github.workspace }}
        run: |
          bin/dotfiles

  update-ref:
    name: Update master branch
    needs:
      - test
    if: |
      github.event_name == 'push' &&
      github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Run GitHub script
        uses: actions/github-script@v3
        with:
          github-token: ${{ secrets.PAT }}
          script: |
            github.git.updateRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'heads/master',
              sha: context.sha,
            })

name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  lint:
    name: Lint
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Run shellcheck
        run: |
          shellcheck bin/dotfiles

  test:
    name: Test
    needs:
      - lint
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Install dotfiles
        env:
          DOTFILES_PATH: ${{ github.workspace }}
        run: |
          bin/dotfiles

  update-ref:
    name: Update master branch
    needs:
      - test
    if: |
      github.event_name == 'push' &&
      github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Run GitHub script
        uses: actions/github-script@v3
        with:
          github-token: ${{ secrets.GH_TOKEN }}
          script: |
            github.git.updateRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'heads/master',
              sha: context.sha,
            })

Rename the token variable name
actions: Rename the token variable name
