LoginSignup
6
2

More than 3 years have passed since last update.

GitHub Actions local action の実行

Last updated at Posted at 2020-08-19

local action の実行

public action ではなく、リポジトリ内に定義したprivate なactionを実行する

ファイルは下記のような感じで配置

.github/
├── actions
│   └── hello
│       ├── action.yml
│       └── index.js
└── workflows
    └── hello.yml

action の定義と script

# .github/actions/hello/action.yml
name: "Hello World"
runs:
  using: "node12"
  main: "index.js"
// .github/actions/hello/index.js
console.log("Hello, World!");

workflow の定義

# .github/workflows/hello.yml
name: Hello
on: push

jobs:
  hello:
    runs-on: ubuntu-latest
    name: Hello
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: run hello action
        uses: ./.github/actions/hello
  • checkout がないとだめ
    • 下記のようなエラーが出る
    • Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/xxx/xxx/.github/actions/hello'. Did you forget to run actions/checkout before running your local action?
6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2