Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
27bce4eee7 | |||
f8b42f7ab4 | |||
2106e8cf10 | |||
db66798ebc | |||
d359fd0772 | |||
350822c32f | |||
abecf4abf4 | |||
604e071d21 | |||
4560c23b39 | |||
59018c2f85 | |||
58740802ef | |||
f109393e79 | |||
268d754764 |
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1 +1,2 @@
|
||||
* text=auto eol=lf
|
||||
* text=auto eol=lf
|
||||
.licenses/** -diff linguist-generated=true
|
20
.github/workflows/licensed.yml
vendored
Normal file
20
.github/workflows/licensed.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Licensed
|
||||
|
||||
on:
|
||||
push: {branches: main}
|
||||
pull_request: {branches: main}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm ci
|
||||
- name: Install licensed
|
||||
run: |
|
||||
cd $RUNNER_TEMP
|
||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
|
||||
sudo tar -xzf licensed.tar.gz
|
||||
sudo mv licensed /usr/local/bin/licensed
|
||||
- run: licensed status
|
15
.licensed.yml
Normal file
15
.licensed.yml
Normal file
@ -0,0 +1,15 @@
|
||||
sources:
|
||||
npm: true
|
||||
|
||||
allowed:
|
||||
- apache-2.0
|
||||
- bsd-2-clause
|
||||
- bsd-3-clause
|
||||
- isc
|
||||
- mit
|
||||
- cc0-1.0
|
||||
- unlicense
|
||||
|
||||
reviewed:
|
||||
npm:
|
||||
- fs.realpath
|
BIN
.licenses/npm/@actions/artifact.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/artifact.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/core.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/core.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/glob.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/glob.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/io.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/io.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@types/tmp.dep.yml
generated
Normal file
BIN
.licenses/npm/@types/tmp.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/balanced-match.dep.yml
generated
Normal file
BIN
.licenses/npm/balanced-match.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/brace-expansion.dep.yml
generated
Normal file
BIN
.licenses/npm/brace-expansion.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/concat-map.dep.yml
generated
Normal file
BIN
.licenses/npm/concat-map.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/fs.realpath.dep.yml
generated
Normal file
BIN
.licenses/npm/fs.realpath.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/glob.dep.yml
generated
Normal file
BIN
.licenses/npm/glob.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/inflight.dep.yml
generated
Normal file
BIN
.licenses/npm/inflight.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/inherits.dep.yml
generated
Normal file
BIN
.licenses/npm/inherits.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/minimatch.dep.yml
generated
Normal file
BIN
.licenses/npm/minimatch.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/once.dep.yml
generated
Normal file
BIN
.licenses/npm/once.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/path-is-absolute.dep.yml
generated
Normal file
BIN
.licenses/npm/path-is-absolute.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/rimraf.dep.yml
generated
Normal file
BIN
.licenses/npm/rimraf.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/tmp-promise.dep.yml
generated
Normal file
BIN
.licenses/npm/tmp-promise.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/tmp.dep.yml
generated
Normal file
BIN
.licenses/npm/tmp.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/tunnel.dep.yml
generated
Normal file
BIN
.licenses/npm/tunnel.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/wrappy.dep.yml
generated
Normal file
BIN
.licenses/npm/wrappy.dep.yml
generated
Normal file
Binary file not shown.
@ -41,6 +41,10 @@ Here are a few things you can do that will increase the likelihood of your pull
|
||||
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
|
||||
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
||||
|
||||
## Licensed
|
||||
|
||||
This repository uses a tool called [Licensed](https://github.com/github/licensed) to verify third party dependencies. You may need to locally install licensed and run `licensed cache` to update the dependency cache if you install or update a production dependency. If licensed cache is unable to determine the dependency, you may need to modify the cache file yourself to put the correct license. You should still verify the dependency, licensed is a tool to help, but is not a substitute for human review of dependencies.
|
||||
|
||||
## Resources
|
||||
|
||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||
|
@ -200,13 +200,17 @@ Environment variables along with context expressions can also be used for input.
|
||||
```
|
||||
|
||||
## Where does the upload go?
|
||||
In the top right corner of a workflow run, once the run is over, if you used this action, there will be a `Artifacts` dropdown which you can download items from. Here's a screenshot of what it looks like<br/>
|
||||
In the top right corner of a workflow run, once the run is over, if you used this action, there will be an `Artifacts` dropdown which you can download items from. Here's a screenshot of what it looks like<br/>
|
||||
<img src="https://user-images.githubusercontent.com/16109154/72556687-20235a80-386d-11ea-9e2a-b534faa77083.png" width="375" height="140">
|
||||
|
||||
There is a trashcan icon that can be used to delete the artifact. This icon will only appear for users who have write permissions to the repository.
|
||||
|
||||
# Limitations
|
||||
|
||||
### Zipped Artifact Downloads
|
||||
|
||||
During a workflow run, files are uploaded and downloaded individually using the `upload-artifact` and `download-artifact` actions. However, when a workflow run finishes and an artifact is downloaded from either the UI or through the [download api](https://developer.github.com/v3/actions/artifacts/#download-an-artifact), a zip is dynamically created with all the file contents that were uploaded. There is currently no way to download artifacts after a workflow run finishes in a format other than a zip or to download artifact contents individually. One of the consequences of this limitation is that if a zip is uploaded during a workflow run and then downloaded from the UI, there will be a double zip created.
|
||||
|
||||
### Permission Loss
|
||||
|
||||
:exclamation: File permissions are not maintained during artifact upload :exclamation: For example, if you make a file executable using `chmod` and then upload that file, post-download the file is no longer guaranteed to be set as an executable.
|
||||
|
@ -17,6 +17,12 @@ inputs:
|
||||
error: Fail the action with an error message
|
||||
ignore: Do not output any warnings or errors, the action does not fail
|
||||
default: 'warn'
|
||||
retention-days:
|
||||
description: >
|
||||
Duration after which artifact will expire in days. 0 means using default retention.
|
||||
|
||||
Minimum 1 day.
|
||||
Maximum 90 days unless changed from the repository settings page.
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
main: 'dist/index.js'
|
||||
|
51
dist/index.js
vendored
51
dist/index.js
vendored
@ -3767,7 +3767,7 @@ class DefaultArtifactClient {
|
||||
}
|
||||
else {
|
||||
// Create an entry for the artifact in the file container
|
||||
const response = yield uploadHttpClient.createArtifactInFileContainer(name);
|
||||
const response = yield uploadHttpClient.createArtifactInFileContainer(name, options);
|
||||
if (!response.fileContainerResourceUrl) {
|
||||
core.debug(response.toString());
|
||||
throw new Error('No URL provided by the Artifact Service to upload an artifact to');
|
||||
@ -4019,6 +4019,9 @@ function run() {
|
||||
const options = {
|
||||
continueOnError: false
|
||||
};
|
||||
if (inputs.retentionDays) {
|
||||
options.retentionDays = inputs.retentionDays;
|
||||
}
|
||||
const uploadResponse = yield artifactClient.uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options);
|
||||
if (uploadResponse.failedItems.length > 0) {
|
||||
core.setFailed(`An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.`);
|
||||
@ -4052,7 +4055,7 @@ exports.getUploadFileConcurrency = getUploadFileConcurrency;
|
||||
// When uploading large files that can't be uploaded with a single http call, this controls
|
||||
// the chunk size that is used during upload
|
||||
function getUploadChunkSize() {
|
||||
return 4 * 1024 * 1024; // 4 MB Chunks
|
||||
return 8 * 1024 * 1024; // 8 MB Chunks
|
||||
}
|
||||
exports.getUploadChunkSize = getUploadChunkSize;
|
||||
// The maximum number of retries that can be attempted before an upload or download fails
|
||||
@ -4108,6 +4111,10 @@ function getWorkSpaceDirectory() {
|
||||
return workspaceDirectory;
|
||||
}
|
||||
exports.getWorkSpaceDirectory = getWorkSpaceDirectory;
|
||||
function getRetentionDays() {
|
||||
return process.env['GITHUB_RETENTION_DAYS'];
|
||||
}
|
||||
exports.getRetentionDays = getRetentionDays;
|
||||
//# sourceMappingURL=config-variables.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -6390,11 +6397,19 @@ function getInputs() {
|
||||
if (!noFileBehavior) {
|
||||
core.setFailed(`Unrecognized ${constants_1.Inputs.IfNoFilesFound} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`);
|
||||
}
|
||||
return {
|
||||
const inputs = {
|
||||
artifactName: name,
|
||||
searchPath: path,
|
||||
ifNoFilesFound: noFileBehavior
|
||||
};
|
||||
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
|
||||
if (retentionDaysStr) {
|
||||
inputs.retentionDays = parseInt(retentionDaysStr);
|
||||
if (isNaN(inputs.retentionDays)) {
|
||||
core.setFailed('Invalid retention-days');
|
||||
}
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
exports.getInputs = getInputs;
|
||||
|
||||
@ -6658,7 +6673,7 @@ const upload_gzip_1 = __webpack_require__(647);
|
||||
const stat = util_1.promisify(fs.stat);
|
||||
class UploadHttpClient {
|
||||
constructor() {
|
||||
this.uploadHttpManager = new http_manager_1.HttpManager(config_variables_1.getUploadFileConcurrency(), 'actions/upload-artifact');
|
||||
this.uploadHttpManager = new http_manager_1.HttpManager(config_variables_1.getUploadFileConcurrency(), '@actions/artifact-upload');
|
||||
this.statusReporter = new status_reporter_1.StatusReporter(10000);
|
||||
}
|
||||
/**
|
||||
@ -6666,12 +6681,17 @@ class UploadHttpClient {
|
||||
* @param {string} artifactName Name of the artifact being created
|
||||
* @returns The response from the Artifact Service if the file container was successfully created
|
||||
*/
|
||||
createArtifactInFileContainer(artifactName) {
|
||||
createArtifactInFileContainer(artifactName, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const parameters = {
|
||||
Type: 'actions_storage',
|
||||
Name: artifactName
|
||||
};
|
||||
// calculate retention period
|
||||
if (options && options.retentionDays) {
|
||||
const maxRetentionStr = config_variables_1.getRetentionDays();
|
||||
parameters.RetentionDays = utils_1.getProperRetention(options.retentionDays, maxRetentionStr);
|
||||
}
|
||||
const data = JSON.stringify(parameters, null, 2);
|
||||
const artifactUrl = utils_1.getArtifactUrl();
|
||||
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
|
||||
@ -7314,6 +7334,7 @@ var Inputs;
|
||||
Inputs["Name"] = "name";
|
||||
Inputs["Path"] = "path";
|
||||
Inputs["IfNoFilesFound"] = "if-no-files-found";
|
||||
Inputs["RetentionDays"] = "retention-days";
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var NoFileOptions;
|
||||
(function (NoFileOptions) {
|
||||
@ -7412,7 +7433,7 @@ const http_manager_1 = __webpack_require__(452);
|
||||
const config_variables_1 = __webpack_require__(401);
|
||||
class DownloadHttpClient {
|
||||
constructor() {
|
||||
this.downloadHttpManager = new http_manager_1.HttpManager(config_variables_1.getDownloadFileConcurrency(), 'actions/download-artifact');
|
||||
this.downloadHttpManager = new http_manager_1.HttpManager(config_variables_1.getDownloadFileConcurrency(), '@actions/artifact-download');
|
||||
// downloads are usually significantly faster than uploads so display status information every second
|
||||
this.statusReporter = new status_reporter_1.StatusReporter(1000);
|
||||
}
|
||||
@ -7942,7 +7963,8 @@ function isRetryableStatusCode(statusCode) {
|
||||
http_client_1.HttpCodes.BadGateway,
|
||||
http_client_1.HttpCodes.ServiceUnavailable,
|
||||
http_client_1.HttpCodes.GatewayTimeout,
|
||||
http_client_1.HttpCodes.TooManyRequests
|
||||
http_client_1.HttpCodes.TooManyRequests,
|
||||
413 // Payload Too Large
|
||||
];
|
||||
return retryableStatusCodes.includes(statusCode);
|
||||
}
|
||||
@ -8136,6 +8158,21 @@ function createEmptyFilesForArtifact(emptyFilesToCreate) {
|
||||
});
|
||||
}
|
||||
exports.createEmptyFilesForArtifact = createEmptyFilesForArtifact;
|
||||
function getProperRetention(retentionInput, retentionSetting) {
|
||||
if (retentionInput < 0) {
|
||||
throw new Error('Invalid retention, minimum value is 1.');
|
||||
}
|
||||
let retention = retentionInput;
|
||||
if (retentionSetting) {
|
||||
const maxRetention = parseInt(retentionSetting);
|
||||
if (!isNaN(maxRetention) && maxRetention < retention) {
|
||||
core_1.warning(`Retention days is greater than the max value allowed by the repository setting, reduce retention to ${maxRetention} days`);
|
||||
retention = maxRetention;
|
||||
}
|
||||
}
|
||||
return retention;
|
||||
}
|
||||
exports.getProperRetention = getProperRetention;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -5,9 +5,9 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/artifact": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.3.3.tgz",
|
||||
"integrity": "sha512-sKC1uA5p6064C6Qypmmt6O8iKlpDyMTfqqDlS4/zfJX1Hs8NbbzPLLN81RpewuJPWQNnroeF52w4VCWypbSNaA==",
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.4.0.tgz",
|
||||
"integrity": "sha512-iPDMvCIogq22F3r11xyBbH2wtUuJYfa3llGM8Kxilx6lVrcGpWa5Bnb1ukD/MEmCn9SBXdz6eqNLa10GQ20HNg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.1",
|
||||
|
@ -28,11 +28,13 @@
|
||||
"url": "https://github.com/actions/upload-artifact/issues"
|
||||
},
|
||||
"homepage": "https://github.com/actions/upload-artifact#readme",
|
||||
"devDependencies": {
|
||||
"@actions/artifact": "^0.3.3",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^0.4.0",
|
||||
"@actions/core": "^1.2.3",
|
||||
"@actions/glob": "^0.1.0",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@actions/io": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/node": "^13.11.1",
|
||||
"@typescript-eslint/parser": "^2.27.0",
|
||||
|
@ -1,7 +1,8 @@
|
||||
export enum Inputs {
|
||||
Name = 'name',
|
||||
Path = 'path',
|
||||
IfNoFilesFound = 'if-no-files-found'
|
||||
IfNoFilesFound = 'if-no-files-found',
|
||||
RetentionDays = 'retention-days'
|
||||
}
|
||||
|
||||
export enum NoFileOptions {
|
||||
|
@ -22,9 +22,19 @@ export function getInputs(): UploadInputs {
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
const inputs = {
|
||||
artifactName: name,
|
||||
searchPath: path,
|
||||
ifNoFilesFound: noFileBehavior
|
||||
} as UploadInputs
|
||||
|
||||
const retentionDaysStr = core.getInput(Inputs.RetentionDays)
|
||||
if (retentionDaysStr) {
|
||||
inputs.retentionDays = parseInt(retentionDaysStr)
|
||||
if (isNaN(inputs.retentionDays)) {
|
||||
core.setFailed('Invalid retention-days')
|
||||
}
|
||||
}
|
||||
|
||||
return inputs
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ async function run(): Promise<void> {
|
||||
const options: UploadOptions = {
|
||||
continueOnError: false
|
||||
}
|
||||
if (inputs.retentionDays) {
|
||||
options.retentionDays = inputs.retentionDays
|
||||
}
|
||||
|
||||
const uploadResponse = await artifactClient.uploadArtifact(
|
||||
inputs.artifactName,
|
||||
searchResult.filesToUpload,
|
||||
|
@ -15,4 +15,9 @@ export interface UploadInputs {
|
||||
* The desired behavior if no files are found with the provided search path
|
||||
*/
|
||||
ifNoFilesFound: NoFileOptions
|
||||
|
||||
/**
|
||||
* Duration after which artifact will expire in days
|
||||
*/
|
||||
retentionDays: number
|
||||
}
|
||||
|
Reference in New Issue
Block a user