mirror of
https://github.com/actions/upload-artifact.git
synced 2025-04-19 06:54:45 +02:00
README updates
This commit is contained in:
parent
9a0e0d1dc0
commit
0fd7594662
3 changed files with 16 additions and 2 deletions
12
README.md
12
README.md
|
@ -88,6 +88,18 @@ Relative and absolute file paths are both allowed. Relative paths are rooted aga
|
|||
|
||||
The [@actions/artifact](https://github.com/actions/toolkit/tree/main/packages/artifact) package is used internally to handle most of the logic around uploading an artifact. There is extra documentation around upload limitations and behavior in the toolkit repo that is worth checking out.
|
||||
|
||||
### Customization if no files are found
|
||||
|
||||
If a path (or paths), result in no files being found for the artifact, the action will succeed but print out a warning. In certain scenarios it may be desirable to fail the action or suppress the warning. The `if-no-files-found` option allows you to customize the behavior of the action if no files are found.
|
||||
|
||||
```yaml
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: my-artifact
|
||||
path: path/to/artifact/
|
||||
if-no-files-found: error # 'warn' or 'suppress' are also available, defaults to `warn`
|
||||
```
|
||||
|
||||
### Conditional Artifact Upload
|
||||
|
||||
To upload artifacts only when the previous step of a job failed, use [`if: failure()`](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-status-check-functions):
|
||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
|
@ -6375,7 +6375,7 @@ function getInputs() {
|
|||
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
|
||||
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
|
||||
if (!noFileBehavior) {
|
||||
core.setFailed(`Unrecognized if-no-files-found input. Provided ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`);
|
||||
core.setFailed(`Unrecognized ${constants_1.Inputs.IfNoFilesFound} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`);
|
||||
}
|
||||
return {
|
||||
artifactName: name,
|
||||
|
|
|
@ -14,7 +14,9 @@ export function getInputs(): UploadInputs {
|
|||
|
||||
if (!noFileBehavior) {
|
||||
core.setFailed(
|
||||
`Unrecognized if-no-files-found input. Provided ${ifNoFilesFound}. Available options: ${Object.keys(
|
||||
`Unrecognized ${
|
||||
Inputs.IfNoFilesFound
|
||||
} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(
|
||||
NoFileOptions
|
||||
)}`
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue