Compare commits

..

8 Commits

Author SHA1 Message Date
Daniel Kennedy
428074b62c CI: clean up artifacts on successful runs 2026-02-25 14:32:24 -05:00
Daniel Kennedy
15af3237b6 Use download-artifact@main temporarily 2026-02-25 14:27:06 -05:00
Daniel Kennedy
ffeab76ee2 Add CI tests for direct uploads 2026-02-25 14:18:40 -05:00
Daniel Kennedy
6b68470975 Support direct file uploads 2026-02-25 14:09:02 -05:00
Daniel Kennedy
4177a106a5 More licensed fixes 2026-02-25 14:09:02 -05:00
Daniel Kennedy
c6ec99779f Try fixing licenced issues 2026-02-25 14:08:44 -05:00
Daniel Kennedy
e785baf943 Bump minimatch to 10.1.1 2026-02-25 14:08:44 -05:00
Daniel Kennedy
9c47937ac2 Cache licenses 2026-02-25 14:08:44 -05:00
3 changed files with 21 additions and 74 deletions

View File

@@ -10,10 +10,6 @@ on:
paths-ignore:
- '**.md'
permissions:
contents: read
actions: write
jobs:
build:
name: Build
@@ -395,20 +391,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node 24
uses: actions/setup-node@v4
with:
node-version: 24.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Delete test artifacts
uses: actions/github-script@v8
uses: actions/github-script@v7
with:
script: |
const keep = ['report.html'];
const owner = context.repo.owner;
const repo = context.repo.repo;
const runId = context.runId;
const artifactClient = require('@actions/artifact');
const artifact = artifactClient.default || artifactClient;
const {data: {artifacts}} = await github.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: runId
});
const {artifacts} = await artifact.listArtifacts({latest: true});
const keep = ['report.html'];
for (const a of artifacts) {
if (keep.includes(a.name)) {
@@ -416,13 +419,10 @@ jobs:
continue;
}
try {
await github.rest.actions.deleteArtifact({
owner,
repo,
artifact_id: a.id
});
await artifact.deleteArtifact(a.name);
console.log(`Deleted artifact '${a.name}'`);
} catch (err) {
console.log(`Could not delete artifact '${a.name}': ${err.message}`);
}
}

View File

@@ -274,57 +274,4 @@ describe('upload', () => {
`Skipping deletion of '${fixtures.artifactName}', it does not exist`
)
})
test('passes skipArchive when archive is false', async () => {
mockInputs({
[Inputs.Archive]: false
})
mockFindFilesToUpload.mockResolvedValue({
filesToUpload: [fixtures.filesToUpload[0]],
rootDirectory: fixtures.rootDirectory
})
await run()
expect(artifact.default.uploadArtifact).toHaveBeenCalledWith(
fixtures.artifactName,
[fixtures.filesToUpload[0]],
fixtures.rootDirectory,
{compressionLevel: 6, skipArchive: true}
)
})
test('does not pass skipArchive when archive is true', async () => {
mockInputs({
[Inputs.Archive]: true
})
mockFindFilesToUpload.mockResolvedValue({
filesToUpload: [fixtures.filesToUpload[0]],
rootDirectory: fixtures.rootDirectory
})
await run()
expect(artifact.default.uploadArtifact).toHaveBeenCalledWith(
fixtures.artifactName,
[fixtures.filesToUpload[0]],
fixtures.rootDirectory,
{compressionLevel: 6}
)
})
test('fails when archive is false and multiple files are provided', async () => {
mockInputs({
[Inputs.Archive]: false
})
await run()
expect(core.setFailed).toHaveBeenCalledWith(
`When 'archive' is set to false, only a single file can be uploaded. Found ${fixtures.filesToUpload.length} files to upload.`
)
expect(artifact.default.uploadArtifact).not.toHaveBeenCalled()
})
})

View File

@@ -3,7 +3,7 @@ description: 'Upload a build artifact that can be used by subsequent workflow st
author: 'GitHub'
inputs:
name:
description: 'Artifact name. If the `archive` input is `false`, the name of the file uploaded will be the artifact name.'
description: 'Artifact name. If the "archive" input is `false`, the name of the file uploaded will be the artifact name.'
default: 'artifact'
path:
description: 'A file, directory or wildcard pattern that describes what to upload.'
@@ -49,7 +49,7 @@ inputs:
description: >
If true, the artifact will be archived (zipped) before uploading.
If false, the artifact will be uploaded as-is without archiving.
When `archive` is `false`, only a single file can be uploaded. The name of the file will be used as the artifact name (ignoring the `name` parameter).
When archive is false, only a single file can be uploaded. The name of the file will be used as the artifact name.
default: 'true'
outputs: