GitHub Actions の continue-on-error とは?
continue-on-error は、step や job が失敗しても続行するよう GitHub に指示し、その失敗をブロッキングしないものとして扱います。
失敗がすべてを止めるべきでない場合もあります。オプションの lint、実験的な matrix セル、ベストエフォートの通知などです。continue-on-error は実行を続けつつ、step が失敗したことも表示します。
概要
step や job に設定する真偽値です。true のとき、失敗は job を(step の場合)や matrix を(job の場合)失敗させず、workflow は続行します。
Non-blocking step
steps:
- name: Optional lint
continue-on-error: true
run: npm run lint
- run: npm test仕組み
continue-on-error: true の step が失敗すると、GitHub はその失敗を記録しつつ次の step に進みます。step の outcome と conclusion の違いを通じて結果を確認できます。
使いどころ
- 失敗を許容したい実験的な matrix セル。
- 通知やアップロードなどのベストエフォートな step。
- 失敗を判断する前に完全な結果を集めたい場合。
なぜ重要か
慎重に使えば、不安定またはオプションの step 1 つがすべてをブロックするのを防げます。不用意に使うと本当の失敗を隠すため、本当に重要でない作業だけに限定してください。
関連する概念
matrix の fail-fast や、step の outcome を確認するエクスプレッションと組み合わせて使います。
重要なポイント
continue-on-errorは失敗をブロッキングしないものにします。- step または job 全体に適用できます。
- 本当の失敗を隠すためではなく、オプションの作業に使います。
関連ガイド
What Is fail-fast in a GitHub Actions Matrix?fail-fast controls whether one failing matrix job cancels the rest. It defaults to true; set it false to let…
What Is an Expression in GitHub Actions?An expression in GitHub Actions is logic inside ${{ }} that evaluates contexts, functions, and operators to c…
What Is a Step in GitHub Actions?A step in GitHub Actions is a single task in a job. It either runs a shell command with run or invokes a reus…
What Is a Matrix Build in GitHub Actions?A matrix build runs the same job many times across combinations of variables, like multiple OS or language ve…