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

name: Lint
on:
pull_request:
branches: [develop, main]
jobs:
run-linters:
name: Run linters
**runs-on: [ubuntu-22.04]**
act -l