Relative path does not work, also error throws exception
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 bug
Context: @actions/artifact
According to README.md, relative paths for files are supported as well as absolute path. However, when trying to use relative path I kept running into fatal error:
Error: File <file> does not exist
Also, if file is not found, the error is thrown even if I use continueOnError: true which is contrary to the docs:
If set to
trueand an error is encountered, the failed file will be skipped and ignored and all other queued files will be attempted to be uploaded.
I've tried try...catch but that did not work either.
I believe the error is due to how path is being checked:
As you can see, rootDirectory is not concatenated with filesToZip.
To Reproduce
const client = artifact.create();
const filePath = path.resolve(__dirname, 'file');
this.spawnSync.call('touch', [filePath]);
fs.openSync(filePath, 'a');
this.spawnSync.call('ls', ['-l', __dirname]);
console.log(fs.existsSync(filePath));
client.uploadArtifact('file-abs-path', [filePath], __dirname, {
continueOnError: true }); // works
client.uploadArtifact('file-rel-path', ['file'], __dirname, {
continueOnError: true }); // does not work, throws error
Expected behavior
- relative path to be functional
continueOnError: trueto not throw error
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 in packages/artifact/src/internal/upload/upload-zip-specification.ts at the referenced path checks, then reproduce the behavior with client.uploadArtifact using a relative file and continueOnError: true. Done means relative paths upload successfully and missing files are skipped without throwing when continueOnError is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100