LoginSignup
7
0

Dependabot で GitHub Actions (composite) の更新を行う

Last updated at Posted at 2022-12-12

はじめに

Dependabot で GitHub Actions の action を更新出来ることはご存じの方も多いと思います

今回は、GitHub Actions の composite action の定義更新も Dependabot にお任せできるのでその設定方法をまとめました

Dependabot について

Dependabot は多くの方が説明されているので省略します
気になる方は、 deoendabot- Qiita の記事をいくつか参照してみてください

Composite action について

Composite action は workflow 内の job で実行する定義をまとめた物です
普段何気なく job に定義して利用しているのは composite action だったと言うことですね

今回は "同一 repository 内に folder を作成し composite action 定義している場合を例に記載します

Dependabot を定義しよう

repository の構成について

設定例を記載する前に、repository 構成等を始めに記載します

今回は、 .github/actions/test-prepare 以下に composite action が定義されているものとし、 .github/workflows/test.yml に定義されている workflow から test-prepare を呼び出しているものとします

.
└── .github
    ├── actions
    |   └── test-prepare
    |      └── action.yml
    └── workflows
        └── test.yml
.github/workflows/test.yml
neme: Test

on:
  push:

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/test-prepare
.github/actions/test-prepare/action.yml
name: "test-prepare"
runs:
  using: "composite"
  steps:
    - run: echo "Hellow World!!"
      shell: bash

.github/dependabot.yml を更新する

それでは .github/dependabot.yml の定義を変更し、 composite action 内の定義も Pull request を作成してもらえるように設定しましょう

.github/dependabot.yml
 version: 2
 updates:
   - package-ecosystem: "github-actions"
     directory: "/"
     schedule:
       interval: "daily"
+  - package-ecosystem: "github-actions"
+    directory: "/.github/actions/test-prepare"
+    schedule:
+      interval: "daily"

package-ecosystem: "github-actions" かつ directory: "/" を定義した場合 .github/workflows を参照します、 今回見て欲しいディレクトリは .github/actions/test-prepare であるため directory: "/.github/actions/test-prepare" と定義することで dependabot が pull request を 作成してくれるようになります

References

7
0
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
7
0