Repository navigation
ci: GitHub Actions の action を lockfile(actions.lock)で固定する - #37
Merged
Merged
Conversation
gh actions-lock(v0.4.0)で、workflow が呼ぶ action と、その中で呼ばれる action のコミットを記録した。 記録と違うコミットは実行時に拒まれるので、タグやブランチが書き換えられても、確かめていないコードは動かない。 lockfile がずれた時に PR で気付けるよう verify-lockfile を足し、 固定した action を lockfile ごと上げられるよう Dependabot の github-actions を足した。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Actions の workflow lockfile(GitHub Actions workflow lockfiles are generally available)を使い、workflow が呼ぶ action のコミットを固定します。タグやブランチが書き換えられても、記録と違うコードは実行時に拒まれます。
変えたこと
gh actions-lock(github/gh-actions-lock v0.4.0)で.github/workflows/actions.lockを作った。直接呼ぶ 3 つ(actions/checkout・ruby/setup-ruby・yasslab/dependabot_auto_merge)と、その中で呼ばれるdependabot/fetch-metadataのコミットを記録したactions/checkout@v7→@v7.0.1、ruby/setup-ruby@v1→@v1.335.0に書き換わった。yasslab/dependabot_auto_merge@mainはブランチのまま記録されるverify-lockfile.ymlを足した。lockfile と workflow がずれた時に PR で落ちる(公式の例を写し、拡張は--pin v0.4.0で固定).github/dependabot.ymlにgithub-actionsを足した。固定した action を lockfile ごと上げる PR を出させる(cooldown 7 日)確かめたこと
gh actions-lock --verifyがAll 4 workflows validマージ後に変わること
scheduler_daily.ymlも、記録したコミットの action で動く。workflow のファイルは触らないので、lockfile はずれないruby/setup-ruby@v1.335.0は公開から 4 日で、cooldown より新しい(ツールの警告)。@v1のままでも同じ版が使われていたyasslab/dependabot_auto_merge@mainを直しても、この repo ではgh actions-lock --relockするまで古いコミットのまま動く