참고

act github

Run github actions workflows locally using act

설치

linux

curl <https://raw.githubusercontent.com/nektos/act/master/install.sh> | sudo bash
sudo mv ./bin/act /bin

mac

brew install act

사용법

<aside> 💡 현재 act를 사용하려는 레포에 .github 폴더가 있고 그 안에 github action workflow들을 정의해놓은 파일들이 있다고 가정

</aside>

[예]

.
├── actionlint.yaml
├── actions
│   └── slack-notify
│       └── action.yaml
├── linters
│   ├── actionlint.yaml
│   ├── .flake8
│   ├── .jscpd.json
│   ├── pyproject.toml
│   └── .yamllint.yaml
└── workflows
    ├── build.yml
    ├── code_coverage.yml
    ├── lint.yaml
    └── slash_command.yml

<aside> 💡 레포의 root directory 위치에서 act 명령어를 사용해야 한다.

</aside>

runner 세팅

github action workflow를 정의한 yaml 파일에서 runs-on에 runner를 정의한다. -P 인자와 함께 사용되며, 기본 runner를 act github에서 찾을 수 있다.

Untitled

name: Lint

on:
  pull_request:
    branches: [develop, main]

jobs:
  run-linters:
    name: Run linters
    **runs-on: [ubuntu-22.04]**

act가 사용할 수 있는 이벤트 리스트 확인

act -l