diff --git a/.github/workflows/artifact-tests.yml b/.github/workflows/artifact-tests.yml index dc7fe62b..2b150fcb 100644 --- a/.github/workflows/artifact-tests.yml +++ b/.github/workflows/artifact-tests.yml @@ -58,25 +58,25 @@ jobs: uses: actions/github-script@v6 with: script: | - const artifact = require('./packages/artifact/lib/artifact') + const artifact = require('./packages/artifact/lib/artifact') - const artifactName = 'my-artifact-${{ matrix.runs-on }}' - console.log('artifactName: ' + artifactName) + const artifactName = 'my-artifact-${{ matrix.runs-on }}' + console.log('artifactName: ' + artifactName) - const fileContents = ['artifact-path/first.txt','artifact-path/second.txt'] + const fileContents = ['artifact-path/first.txt','artifact-path/second.txt'] - const uploadResult = await artifact.create().uploadArtifact(artifactName, fileContents, './') - console.log(uploadResult) + const uploadResult = await artifact.create().uploadArtifact(artifactName, fileContents, './') + console.log(uploadResult) - const success = uploadResult.success - const size = uploadResult.size - const id = uploadResult.id + const success = uploadResult.success + const size = uploadResult.size + const id = uploadResult.id - if (!success) { - throw new Error('Failed to upload artifact') - } else { - console.log(`Successfully uploaded artifact ${id}`) - } + if (!success) { + throw new Error('Failed to upload artifact') + } else { + console.log(`Successfully uploaded artifact ${id}`) + } verify: runs-on: ubuntu-latest @@ -122,14 +122,14 @@ jobs: } const artifactNames = artifacts.map(artifact => artifact.name) - if (!artifactNames.contains('my-artifact-ubuntu-latest')){ - throw new Error('Expected artifact list to contain an artifact named my-artifact-ubuntu-latest but it did not find one') + if (!artifactNames.includes('my-artifact-ubuntu-latest')){ + throw new Error("Expected artifact list to contain an artifact named my-artifact-ubuntu-latest but it's missing") } - if (!artifactNames.contains('my-artifact-windows-latest')){ - throw new Error('Expected artifact list to contain an artifact named my-artifact-windows-latest but it did not find one') + if (!artifactNames.includes('my-artifact-windows-latest')){ + throw new Error("Expected artifact list to contain an artifact named my-artifact-windows-latest but it's missing") } - if (!artifactNames.contains('my-artifact-macos-latest')){ - throw new Error('Expected artifact list to contain an artifact named my-artifact-macos-latest but it did not find one') + if (!artifactNames.includes('my-artifact-macos-latest')){ + throw new Error("Expected artifact list to contain an artifact named my-artifact-macos-latest but it's missing") } console.log('Successfully listed artifacts that were uploaded') diff --git a/packages/artifact/src/internal/find/list-artifacts.ts b/packages/artifact/src/internal/find/list-artifacts.ts index 3d39c7b9..7fd96838 100644 --- a/packages/artifact/src/internal/find/list-artifacts.ts +++ b/packages/artifact/src/internal/find/list-artifacts.ts @@ -29,7 +29,7 @@ export async function listArtifacts( repositoryName: string, token: string ): Promise { - info(`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}\\${repositoryName}`) + info(`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}`) const artifacts: Artifact[] = [] const [retryOpts, requestOpts] = getRetryOptions( @@ -73,7 +73,7 @@ export async function listArtifacts( listArtifactResponse.artifacts.forEach(artifact => { artifacts.push({ name: artifact.name, - artifactId: artifact.id, + id: artifact.id, url: artifact.url, size: artifact.size_in_bytes }) @@ -100,7 +100,7 @@ export async function listArtifacts( listArtifactResponse.artifacts.forEach(artifact => { artifacts.push({ name: artifact.name, - artifactId: artifact.id, + id: artifact.id, url: artifact.url, size: artifact.size_in_bytes }) diff --git a/packages/artifact/src/internal/shared/interfaces.ts b/packages/artifact/src/internal/shared/interfaces.ts index 7991bbf6..83562dab 100644 --- a/packages/artifact/src/internal/shared/interfaces.ts +++ b/packages/artifact/src/internal/shared/interfaces.ts @@ -114,7 +114,7 @@ export interface Artifact { /** * The ID of the artifact */ - artifactId: number + id: number /** * The URL of the artifact