Add tests for E2E artifact upload

This commit is contained in:
Konrad Pabjan
2023-08-17 09:37:45 -04:00
parent c9dab8c79d
commit cf1b02a2e3
4 changed files with 26 additions and 36 deletions

View File

@@ -0,0 +1,5 @@
name: 'Set env variables'
description: 'Sets certain env variables so that e2e artifact upload, list, get and download can be tested in a shell'
runs:
using: 'node12'
main: 'index.js'

View File

@@ -0,0 +1,14 @@
// Certain env variables are not set by default in a shell context and are only available in a node context from a running action
// In order to be able to upload and download artifacts e2e in a shell when running CI tests, we need these env variables set
const fs = require('fs');
const os = require('os');
const filePath = process.env[`GITHUB_ENV`]
fs.appendFileSync(filePath, `ACTIONS_RESULTS_URL=${process.env.ACTIONS_RESULTS_URL}${os.EOL}`, {
encoding: 'utf8'
})
fs.appendFileSync(filePath, `ACTIONS_RUNTIME_TOKEN=${process.env.ACTIONS_RUNTIME_TOKEN}${os.EOL}`, {
encoding: 'utf8'
})
fs.appendFileSync(filePath, `GITHUB_RUN_ID=${process.env.GITHUB_RUN_ID}${os.EOL}`, {
encoding: 'utf8'
})

View File

@@ -10,8 +10,8 @@
],
"homepage": "https://github.com/actions/toolkit/tree/main/packages/artifact",
"license": "MIT",
"main": "lib/artifact-client.js",
"types": "lib/artifact-client.d.ts",
"main": "lib/artifact.js",
"types": "lib/artifact.d.ts",
"directories": {
"lib": "lib",
"test": "__tests__"