5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Tips]GitHub Actionsのactionのバージョンもdependabotは監視してくれる

5
Last updated at Posted at 2022-11-17

GitHubで、npmやgemなどのバージョンを最新に保つことなどを目的に、dependabotをリポジトリで管理している人や組織は多いと思いますが、GitHub ActionsのactionもアップデートするためのPRを作ってくれます。
.github/dependabotに下記のような記述をします。

.github/dependabot.yml
version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    open-pull-requests-limit: 5
    schedule:
      interval: "weekly"
      day: "thursday"
      time: "19:35"
      timezone: "Asia/Tokyo"
    reviewers:
      - "Umekawa" # ここは自分のIDとか組織ならグループとか

これで、毎週日本時間木曜19時35分に5コマで、レビュワーがUmekawa(私のGitHubのIDです)のGitHub Actions関連のPRを作ってくれるようになります。

例として、下記のようなスクリプトを書いてみましょう。

.github/workflows/build_image.yml (必要な部分のみ抜粋)
name: Build image

on:
  push:
    branches:
      - main
  workflow_dispatch:

permissions:
  contents: read
  packages: write

jobs:
  build_image:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v1

actions/checkoutの最新バージョンはv3.1.0(v3)ですが、ここではv1になってしまっています。
しかし、設定を書いたことでdependabotがしっかり監視してくれているのでアップデートするPRを作ってくれます。

スクリーンショット 2022-11-17 20.31.48.png

スクリーンショット 2022-11-17 20.36.06.png

ライブラリ関連は知らない間に老朽化していくので、ツールの力も使って楽に最新に保ちましょう。

今回のコードはここで実際に動かして検証しています。興味がある人は覗いてみてください。
https://github.com/Umekawa/github-actions-sample

5
1
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
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?