LoginSignup
2

More than 1 year has passed since last update.

posted at

updated at

Organization

GitHub Actions local action の実行

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?

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
What you can do with signing up
2