概要
ローカルホストランナーnektos/actは便利ですね。ただ、完全な互換性があるわけじゃないので、エラーでワークフローが止まってしまうのは困ってしまいます。
ここではmそんな非互換性エラーあるあるの一つactions/upload-artifact
での回避する方法を。
エラーメッセージ
[Playwright Tests/test] ❗ ::error::Unable to get ACTIONS_RUNTIME_TOKEN env variable
[Playwright Tests/test] ❌ Failure - actions/upload-artifact@v2
[Playwright Tests/test] exit with `FAILURE`: 1
対策
オプション --artifact-server-path
を使います。
ただ、nektos/act公式でのほとんど記載がないので。。。
$ mkdir -p /tmp/act-artifacts
$ act pull_request --artifact-server-path /tmp/act-artifacts
...
(中略)
...
| Artifact has been finalized. All files have been successfully uploaded!
|
| The raw size of all the files that were specified for upload is 434264 bytes
| The size of all the files that were uploaded is 189238 bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
|
| Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads
|
| Artifact playwright-report has been successfully uploaded!
[Playwright Tests/test] ✅ Success - actions/upload-artifact@v3
設定したディレクトリを確認してみます
$ ls -la /tmp/act-artifacts
total 0
drwxr-xr-x 3 nagayaoh wheel 96 5 1 21:13 .
drwxr-xr-x 3 nagayaoh wheel 96 5 1 21:13 ..
drwxr-xr-x 3 nagayaoh wheel 96 5 1 21:13 1/
Artifacts、こちらにできていますね。
$ ls -la /tmp/act-artifacts/1/
total 0
drwxr-xr-x 3 nagayaoh wheel 96 5 1 21:13 .
drwxr-xr-x 3 nagayaoh wheel 96 5 1 21:13 ..
drwxr-xr-x 3 nagayaoh wheel 96 5 1 21:13 playwright-report
感想
nektos/act
Actionsのデバッガだけじゃなくて、ローカルランナー(makeがわり)としても便利です。ただ、まだ情報が行き渡っていない感じですね。オプションをいろいろ調べれば、もっと気軽に使えそうですね。