8
6

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 1 year has passed since last update.

[Github Actions] / nektos/act - upload-artifactsで困ったら

Last updated at Posted at 2022-05-01

概要

ローカルホストランナー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がわり)としても便利です。ただ、まだ情報が行き渡っていない感じですね。オプションをいろいろ調べれば、もっと気軽に使えそうですね。

参考

8
6
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
8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?