Compare commits
23 Commits
ejahnGithu
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
6b63a2bfc3 | |
|
|
290017ff81 | |
|
|
2a876cd69d | |
|
|
f79b906406 | |
|
|
dcae869a03 | |
|
|
23769d04c7 | |
|
|
d3ab50471b | |
|
|
1388fd1cac | |
|
|
5b446d2657 | |
|
|
006d6978c1 | |
|
|
02afeb1577 | |
|
|
d47594b536 | |
|
|
2823824b94 | |
|
|
cbc06d6766 | |
|
|
9bb6708527 | |
|
|
be1151df02 | |
|
|
130842f4e8 | |
|
|
ab82301c62 | |
|
|
fea4f6b5c5 | |
|
|
d3ade9ecfc | |
|
|
fb592eec03 | |
|
|
70e79399a2 | |
|
|
acb230b99a |
|
|
@ -1,5 +1,12 @@
|
||||||
# @actions/artifact Releases
|
# @actions/artifact Releases
|
||||||
|
|
||||||
|
### 4.0.0
|
||||||
|
|
||||||
|
- Add support for Node 24 [#2110](https://github.com/actions/toolkit/pull/2110)
|
||||||
|
- Fix: artifact pagination bugs and configurable artifact count limits [#2165](https://github.com/actions/toolkit/pull/2165)
|
||||||
|
- Fix: reject the promise on timeout [#2124](https://github.com/actions/toolkit/pull/2124)
|
||||||
|
- Update dependency versions
|
||||||
|
|
||||||
### 2.3.3
|
### 2.3.3
|
||||||
|
|
||||||
- Dependency updates [#2049](https://github.com/actions/toolkit/pull/2049)
|
- Dependency updates [#2049](https://github.com/actions/toolkit/pull/2049)
|
||||||
|
|
|
||||||
|
|
@ -105,3 +105,45 @@ describe('uploadConcurrencyEnv', () => {
|
||||||
}).toThrow()
|
}).toThrow()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('getMaxArtifactListCount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
delete process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return default 1000 when no env set', () => {
|
||||||
|
expect(config.getMaxArtifactListCount()).toBe(1000)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return value set in ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT', () => {
|
||||||
|
process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT = '2000'
|
||||||
|
expect(config.getMaxArtifactListCount()).toBe(2000)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should throw if value set in ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT is invalid', () => {
|
||||||
|
process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT = 'abc'
|
||||||
|
expect(() => {
|
||||||
|
config.getMaxArtifactListCount()
|
||||||
|
}).toThrow(
|
||||||
|
'Invalid value set for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT env variable'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should throw if ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT is < 1', () => {
|
||||||
|
process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT = '0'
|
||||||
|
expect(() => {
|
||||||
|
config.getMaxArtifactListCount()
|
||||||
|
}).toThrow(
|
||||||
|
'Invalid value set for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT env variable'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should throw if ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT is negative', () => {
|
||||||
|
process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT = '-100'
|
||||||
|
expect(() => {
|
||||||
|
config.getMaxArtifactListCount()
|
||||||
|
}).toThrow(
|
||||||
|
'Invalid value set for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT env variable'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,126 @@ describe('list-artifact', () => {
|
||||||
)
|
)
|
||||||
).rejects.toThrow('boom')
|
).rejects.toThrow('boom')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should handle pagination correctly when fetching multiple pages', async () => {
|
||||||
|
const mockRequest = github.getOctokit(fixtures.token)
|
||||||
|
.request as MockedRequest
|
||||||
|
|
||||||
|
const manyArtifacts = Array.from({length: 150}, (_, i) => ({
|
||||||
|
id: i + 1,
|
||||||
|
name: `artifact-${i + 1}`,
|
||||||
|
size: 100,
|
||||||
|
createdAt: new Date('2023-12-01')
|
||||||
|
}))
|
||||||
|
|
||||||
|
mockRequest
|
||||||
|
.mockResolvedValueOnce({
|
||||||
|
status: 200,
|
||||||
|
headers: {},
|
||||||
|
url: '',
|
||||||
|
data: {
|
||||||
|
...artifactsToListResponse(manyArtifacts.slice(0, 100)),
|
||||||
|
total_count: 150
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.mockResolvedValueOnce({
|
||||||
|
status: 200,
|
||||||
|
headers: {},
|
||||||
|
url: '',
|
||||||
|
data: {
|
||||||
|
...artifactsToListResponse(manyArtifacts.slice(100, 150)),
|
||||||
|
total_count: 150
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const response = await listArtifactsPublic(
|
||||||
|
fixtures.runId,
|
||||||
|
fixtures.owner,
|
||||||
|
fixtures.repo,
|
||||||
|
fixtures.token,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
// Verify that both API calls were made
|
||||||
|
expect(mockRequest).toHaveBeenCalledTimes(2)
|
||||||
|
|
||||||
|
// Should return all 150 artifacts across both pages
|
||||||
|
expect(response.artifacts).toHaveLength(150)
|
||||||
|
|
||||||
|
// Verify we got artifacts from both pages
|
||||||
|
expect(response.artifacts[0].name).toBe('artifact-1')
|
||||||
|
expect(response.artifacts[99].name).toBe('artifact-100')
|
||||||
|
expect(response.artifacts[100].name).toBe('artifact-101')
|
||||||
|
expect(response.artifacts[149].name).toBe('artifact-150')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should respect ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT environment variable', async () => {
|
||||||
|
const originalEnv = process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT
|
||||||
|
process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT = '150'
|
||||||
|
|
||||||
|
jest.resetModules()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const {listArtifactsPublic: listArtifactsPublicReloaded} = await import(
|
||||||
|
'../src/internal/find/list-artifacts'
|
||||||
|
)
|
||||||
|
const githubReloaded = await import('@actions/github')
|
||||||
|
|
||||||
|
const mockRequest = (githubReloaded.getOctokit as jest.Mock)(
|
||||||
|
fixtures.token
|
||||||
|
).request as MockedRequest
|
||||||
|
|
||||||
|
const manyArtifacts = Array.from({length: 200}, (_, i) => ({
|
||||||
|
id: i + 1,
|
||||||
|
name: `artifact-${i + 1}`,
|
||||||
|
size: 100,
|
||||||
|
createdAt: new Date('2023-12-01')
|
||||||
|
}))
|
||||||
|
|
||||||
|
mockRequest
|
||||||
|
.mockResolvedValueOnce({
|
||||||
|
status: 200,
|
||||||
|
headers: {},
|
||||||
|
url: '',
|
||||||
|
data: {
|
||||||
|
...artifactsToListResponse(manyArtifacts.slice(0, 100)),
|
||||||
|
total_count: 200
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.mockResolvedValueOnce({
|
||||||
|
status: 200,
|
||||||
|
headers: {},
|
||||||
|
url: '',
|
||||||
|
data: {
|
||||||
|
...artifactsToListResponse(manyArtifacts.slice(100, 150)),
|
||||||
|
total_count: 200
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const response = await listArtifactsPublicReloaded(
|
||||||
|
fixtures.runId,
|
||||||
|
fixtures.owner,
|
||||||
|
fixtures.repo,
|
||||||
|
fixtures.token,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
// Should only return 150 artifacts due to the limit
|
||||||
|
expect(response.artifacts).toHaveLength(150)
|
||||||
|
expect(response.artifacts[0].name).toBe('artifact-1')
|
||||||
|
expect(response.artifacts[149].name).toBe('artifact-150')
|
||||||
|
} finally {
|
||||||
|
// Restore original environment variable
|
||||||
|
if (originalEnv !== undefined) {
|
||||||
|
process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT = originalEnv
|
||||||
|
} else {
|
||||||
|
delete process.env.ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset modules again to restore original state
|
||||||
|
jest.resetModules()
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('internal', () => {
|
describe('internal', () => {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/artifact",
|
"name": "@actions/artifact",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/artifact",
|
"name": "@actions/artifact",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/artifact",
|
"name": "@actions/artifact",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions artifact lib",
|
"description": "Actions artifact lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ import {retry} from '@octokit/plugin-retry'
|
||||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||||
import {internalArtifactTwirpClient} from '../shared/artifact-twirp-client'
|
import {internalArtifactTwirpClient} from '../shared/artifact-twirp-client'
|
||||||
import {getBackendIdsFromToken} from '../shared/util'
|
import {getBackendIdsFromToken} from '../shared/util'
|
||||||
|
import {getMaxArtifactListCount} from '../shared/config'
|
||||||
import {ListArtifactsRequest, Timestamp} from '../../generated'
|
import {ListArtifactsRequest, Timestamp} from '../../generated'
|
||||||
|
|
||||||
// Limiting to 1000 for perf reasons
|
const maximumArtifactCount = getMaxArtifactListCount()
|
||||||
const maximumArtifactCount = 1000
|
|
||||||
const paginationCount = 100
|
const paginationCount = 100
|
||||||
const maxNumberOfPages = maximumArtifactCount / paginationCount
|
const maxNumberOfPages = Math.ceil(maximumArtifactCount / paginationCount)
|
||||||
|
|
||||||
export async function listArtifactsPublic(
|
export async function listArtifactsPublic(
|
||||||
workflowRunId: number,
|
workflowRunId: number,
|
||||||
|
|
@ -59,7 +59,7 @@ export async function listArtifactsPublic(
|
||||||
const totalArtifactCount = listArtifactResponse.total_count
|
const totalArtifactCount = listArtifactResponse.total_count
|
||||||
if (totalArtifactCount > maximumArtifactCount) {
|
if (totalArtifactCount > maximumArtifactCount) {
|
||||||
warning(
|
warning(
|
||||||
`Workflow run ${workflowRunId} has more than 1000 artifacts. Results will be incomplete as only the first ${maximumArtifactCount} artifacts will be returned`
|
`Workflow run ${workflowRunId} has ${totalArtifactCount} artifacts, exceeding the limit of ${maximumArtifactCount}. Results will be incomplete as only the first ${maximumArtifactCount} artifacts will be returned`
|
||||||
)
|
)
|
||||||
numberOfPages = maxNumberOfPages
|
numberOfPages = maxNumberOfPages
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +81,7 @@ export async function listArtifactsPublic(
|
||||||
// Iterate over any remaining pages
|
// Iterate over any remaining pages
|
||||||
for (
|
for (
|
||||||
currentPageNumber;
|
currentPageNumber;
|
||||||
currentPageNumber < numberOfPages;
|
currentPageNumber <= numberOfPages;
|
||||||
currentPageNumber++
|
currentPageNumber++
|
||||||
) {
|
) {
|
||||||
debug(`Fetching page ${currentPageNumber} of artifact list`)
|
debug(`Fetching page ${currentPageNumber} of artifact list`)
|
||||||
|
|
|
||||||
|
|
@ -97,3 +97,19 @@ export function getUploadChunkTimeout(): number {
|
||||||
|
|
||||||
return timeout
|
return timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This value can be changed with ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT variable.
|
||||||
|
// Defaults to 1000 as a safeguard for rate limiting.
|
||||||
|
export function getMaxArtifactListCount(): number {
|
||||||
|
const maxCountVar =
|
||||||
|
process.env['ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT'] || '1000'
|
||||||
|
|
||||||
|
const maxCount = parseInt(maxCountVar)
|
||||||
|
if (isNaN(maxCount) || maxCount < 1) {
|
||||||
|
throw new Error(
|
||||||
|
'Invalid value set for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT env variable'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxCount
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
# @actions/attest Releases
|
# @actions/attest Releases
|
||||||
|
|
||||||
|
### 2.0.0
|
||||||
|
|
||||||
|
- Add support for Node 24 [#2110](https://github.com/actions/toolkit/pull/2110)
|
||||||
|
- Bump @sigstore/bundle from 3.0.0 to 3.1.0
|
||||||
|
- Bump @sigstore/sign from 3.0.0 to 3.1.0
|
||||||
|
- Bump jose from 5.2.3 to 5.10.0
|
||||||
|
|
||||||
### 1.6.0
|
### 1.6.0
|
||||||
|
|
||||||
- Update `buildSLSAProvenancePredicate` to populate `workflow.ref` field from the `ref` claim in the OIDC token [#1969](https://github.com/actions/toolkit/pull/1969)
|
- Update `buildSLSAProvenancePredicate` to populate `workflow.ref` field from the `ref` claim in the OIDC token [#1969](https://github.com/actions/toolkit/pull/1969)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/attest",
|
"name": "@actions/attest",
|
||||||
"version": "1.6.0",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/attest",
|
"name": "@actions/attest",
|
||||||
"version": "1.6.0",
|
"version": "2.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/attest",
|
"name": "@actions/attest",
|
||||||
"version": "1.6.0",
|
"version": "2.0.0",
|
||||||
"description": "Actions attestation lib",
|
"description": "Actions attestation lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# @actions/exec Releases
|
# @actions/exec Releases
|
||||||
|
|
||||||
|
### 2.0.0
|
||||||
|
- Add support for Node 24 [#2110](https://github.com/actions/toolkit/pull/2110)
|
||||||
|
- Bump @actions/io dependency from ^1.0.1 to ^2.0.0
|
||||||
|
|
||||||
### 1.1.1
|
### 1.1.1
|
||||||
- Update `lockfileVersion` to `v2` in `package-lock.json [#1024](https://github.com/actions/toolkit/pull/1024)
|
- Update `lockfileVersion` to `v2` in `package-lock.json [#1024](https://github.com/actions/toolkit/pull/1024)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/exec",
|
"name": "@actions/exec",
|
||||||
"version": "1.1.1",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/exec",
|
"name": "@actions/exec",
|
||||||
"version": "1.1.1",
|
"version": "2.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/io": "^1.0.1"
|
"@actions/io": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/io": {
|
"node_modules/@actions/io": {
|
||||||
"version": "1.1.3",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz",
|
||||||
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==",
|
"integrity": "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/exec",
|
"name": "@actions/exec",
|
||||||
"version": "1.1.1",
|
"version": "2.0.0",
|
||||||
"description": "Actions exec lib",
|
"description": "Actions exec lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|
@ -36,6 +36,6 @@
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/io": "^1.0.1"
|
"@actions/io": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
|
## 3.0.0
|
||||||
|
- Add support for Node 24 [#2110](https://github.com/actions/toolkit/pull/2110)
|
||||||
|
|
||||||
## 2.2.3
|
## 2.2.3
|
||||||
- Fixed an issue where proxy username and password were not handled correctly [#1799](https://github.com/actions/toolkit/pull/1799)
|
- Fixed an issue where proxy username and password were not handled correctly [#1799](https://github.com/actions/toolkit/pull/1799)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# @actions/io Releases
|
# @actions/io Releases
|
||||||
|
|
||||||
|
### 2.0.0
|
||||||
|
- Add support for Node 24 [#2110](https://github.com/actions/toolkit/pull/2110)
|
||||||
|
- Ensures consistent behavior for paths on Node 24 with Windows
|
||||||
|
|
||||||
### 1.1.3
|
### 1.1.3
|
||||||
- Replace `child_process.exec` with `fs.rm` in `rmRF` for all OS implementations [#1373](https://github.com/actions/toolkit/pull/1373)
|
- Replace `child_process.exec` with `fs.rm` in `rmRF` for all OS implementations [#1373](https://github.com/actions/toolkit/pull/1373)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue