@actions/artifact: Support custom Octokit client
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the enhancement
downloadArtifact function does not retry if GitHub API returned an error such as status 500. This is because the Octokit client is hardcoded as below:
It would be nice if downloadArtifact function supports an option to pass an Octokit client. Here is an example snippet:
import * as github from '@actions/github'
import { retry } from '@octokit/plugin-retry'
import { DefaultArtifactClient } from '@actions/artifact'
const example = () => {
const octokit = github.getOctokit(token, {}, retry)
const artifactClient = new DefaultArtifactClient()
artifactClient.downloadArtifact(artifactId, {
path: 'example-directory',
findBy: {
workflowRunId: workflowRunId,
repositoryOwner: github.context.repo.owner,
repositoryName: github.context.repo.repo,
octokit: octokit,
},
})
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/artifact/src/internal/download/download-artifact.ts at the linked hardcoded Octokit client and trace the downloadArtifact options and findBy types. Check the existing artifact tests before making changes; done means callers can provide a custom Octokit client for artifact downloads and that the client is used for the GitHub API request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100