mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-28 17:04:53 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69a62cdfa4 | ||
|
|
3cb40c9234 | ||
|
|
75c1124b14 | ||
|
|
766cde6ce5 | ||
|
|
1352fce070 | ||
|
|
12ecc67b1a | ||
|
|
b388ef8bf2 | ||
|
|
818dc836a0 | ||
|
|
60e36109df | ||
|
|
7098b54017 | ||
|
|
539d415250 | ||
|
|
af51f9ed91 | ||
|
|
6e7a81b68f | ||
|
|
6bbc94d747 | ||
|
|
20ece23417 | ||
|
|
503d9f28e7 | ||
|
|
f8491fe25c | ||
|
|
de75c272ff | ||
|
|
5e811dcf4c | ||
|
|
f14d75a58d | ||
|
|
2727d0f5db | ||
|
|
67de43d94c | ||
|
|
1996917397 |
@@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
dist/
|
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
"es6": true,
|
"es2021": true,
|
||||||
"jest": true,
|
"node": true,
|
||||||
"node": true
|
"jest": true
|
||||||
},
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"globals": {
|
|
||||||
"Atomics": "readonly",
|
|
||||||
"SharedArrayBuffer": "readonly"
|
|
||||||
},
|
},
|
||||||
|
"plugins": ["github"],
|
||||||
|
"extends": ["eslint:recommended", "prettier", "plugin:github/internal"],
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2020
|
"ecmaVersion": 12
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"semi": ["error", "never"]
|
"semi": ["error", "never"]
|
||||||
}
|
},
|
||||||
|
"ignorePatterns": ["/dist/", "/pre/"]
|
||||||
}
|
}
|
||||||
42
.github/release-drafter.yml
vendored
42
.github/release-drafter.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name-template: "v$RESOLVED_VERSION"
|
name-template: 'v$RESOLVED_VERSION'
|
||||||
tag-template: "v$RESOLVED_VERSION"
|
tag-template: 'v$RESOLVED_VERSION'
|
||||||
template: |
|
template: |
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
@@ -8,33 +8,33 @@ template: |
|
|||||||
|
|
||||||
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
|
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
|
||||||
categories:
|
categories:
|
||||||
- title: "🚀 Features"
|
- title: '🚀 Features'
|
||||||
labels:
|
labels:
|
||||||
- "feature"
|
- 'feature'
|
||||||
- "enhancement"
|
- 'enhancement'
|
||||||
- title: "🐛 Bug Fixes"
|
- title: '🐛 Bug Fixes'
|
||||||
labels:
|
labels:
|
||||||
- "fix"
|
- 'fix'
|
||||||
- "bugfix"
|
- 'bugfix'
|
||||||
- "bug"
|
- 'bug'
|
||||||
- title: "🧰 Maintenance"
|
- title: '🧰 Maintenance'
|
||||||
labels:
|
labels:
|
||||||
- "infrastructure"
|
- 'infrastructure'
|
||||||
- "automation"
|
- 'automation'
|
||||||
- "documentation"
|
- 'documentation'
|
||||||
- title: "🏎 Performance"
|
- title: '🏎 Performance'
|
||||||
label: "performance"
|
label: 'performance'
|
||||||
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
|
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
||||||
version-resolver:
|
version-resolver:
|
||||||
major:
|
major:
|
||||||
labels:
|
labels:
|
||||||
- "type: breaking"
|
- 'type: breaking'
|
||||||
minor:
|
minor:
|
||||||
labels:
|
labels:
|
||||||
- "type: enhancement"
|
- 'type: enhancement'
|
||||||
patch:
|
patch:
|
||||||
labels:
|
labels:
|
||||||
- "type: bug"
|
- 'type: bug'
|
||||||
- "type: maintenance"
|
- 'type: maintenance'
|
||||||
- "type: documentation"
|
- 'type: documentation'
|
||||||
default: patch
|
default: patch
|
||||||
|
|||||||
4
.github/workflows/check-linter.yml
vendored
4
.github/workflows/check-linter.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Checking linter
|
name: Check linter
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -31,4 +31,4 @@ jobs:
|
|||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Verify linter
|
- name: Verify linter
|
||||||
run: npm run lint
|
run: npm run lint:check
|
||||||
|
|||||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -9,7 +9,7 @@
|
|||||||
# the `language` matrix defined below to confirm you have the correct set of
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
# supported CodeQL languages.
|
# supported CodeQL languages.
|
||||||
#
|
#
|
||||||
name: "CodeQL"
|
name: 'CodeQL'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
TAG_NAME:
|
TAG_NAME:
|
||||||
description: "Tag name that the major tag will point to"
|
description: 'Tag name that the major tag will point to'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -1 +1,6 @@
|
|||||||
node_modules/
|
# Ignore build artifacts
|
||||||
|
/dist/
|
||||||
|
/pre/
|
||||||
|
|
||||||
|
# Ignore all Markdown files
|
||||||
|
*.md
|
||||||
|
|||||||
@@ -66,9 +66,11 @@ There are a few important considerations to be aware of:
|
|||||||
|
|
||||||
In order to release a new version of this Action:
|
In order to release a new version of this Action:
|
||||||
|
|
||||||
1. Publish the draft release from the `main` branch with semantic version as the tag name, _with_ the checkbox to publish to the GitHub Marketplace checked. :ballot_box_with_check:
|
1. Locate the semantic version of the [upcoming release][release-list] (a draft is maintained by the [`draft-release` workflow][draft-release]).
|
||||||
|
|
||||||
2. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding the major version tag such as `v1`.
|
2. Publish the draft release from the `main` branch with semantic version as the tag name, _with_ the checkbox to publish to the GitHub Marketplace checked. :ballot_box_with_check:
|
||||||
|
|
||||||
|
3. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding the major version tag such as `v1`.
|
||||||
|
|
||||||
⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs].
|
⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs].
|
||||||
|
|
||||||
@@ -81,5 +83,7 @@ The scripts and documentation in this project are released under the [MIT Licens
|
|||||||
[upload-pages-artifact]: https://github.com/actions/upload-pages-artifact
|
[upload-pages-artifact]: https://github.com/actions/upload-pages-artifact
|
||||||
[artifacts]: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
|
[artifacts]: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
|
||||||
[environment-protection]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules
|
[environment-protection]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules
|
||||||
|
[release-list]: https://github.com/actions/deploy-pages/releases
|
||||||
|
[draft-release]: .github/workflows/draft-release.yml
|
||||||
[release]: .github/workflows/release.yml
|
[release]: .github/workflows/release.yml
|
||||||
[release-workflow-runs]: https://github.com/actions/deploy-pages/actions/workflows/release.yml
|
[release-workflow-runs]: https://github.com/actions/deploy-pages/actions/workflows/release.yml
|
||||||
@@ -1 +0,0 @@
|
|||||||
module.exports = {presets: ['@babel/preset-env']}
|
|
||||||
57
dist/index.js
vendored
57
dist/index.js
vendored
@@ -140,7 +140,6 @@ const file_command_1 = __nccwpck_require__(717);
|
|||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
const os = __importStar(__nccwpck_require__(2087));
|
const os = __importStar(__nccwpck_require__(2087));
|
||||||
const path = __importStar(__nccwpck_require__(5622));
|
const path = __importStar(__nccwpck_require__(5622));
|
||||||
const uuid_1 = __nccwpck_require__(5840);
|
|
||||||
const oidc_utils_1 = __nccwpck_require__(8041);
|
const oidc_utils_1 = __nccwpck_require__(8041);
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
@@ -170,21 +169,10 @@ function exportVariable(name, val) {
|
|||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
const filePath = process.env['GITHUB_ENV'] || '';
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
|
||||||
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
|
|
||||||
if (name.includes(delimiter)) {
|
|
||||||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
|
||||||
}
|
}
|
||||||
if (convertedVal.includes(delimiter)) {
|
|
||||||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
|
||||||
}
|
|
||||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
|
||||||
file_command_1.issueCommand('ENV', commandValue);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
* Registers a secret which will get masked from logs
|
* Registers a secret which will get masked from logs
|
||||||
@@ -201,7 +189,7 @@ exports.setSecret = setSecret;
|
|||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
const filePath = process.env['GITHUB_PATH'] || '';
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
file_command_1.issueCommand('PATH', inputPath);
|
file_command_1.issueFileCommand('PATH', inputPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
@@ -241,8 +229,11 @@ function getMultilineInput(name, options) {
|
|||||||
const inputs = getInput(name, options)
|
const inputs = getInput(name, options)
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(x => x !== '');
|
.filter(x => x !== '');
|
||||||
|
if (options && options.trimWhitespace === false) {
|
||||||
return inputs;
|
return inputs;
|
||||||
}
|
}
|
||||||
|
return inputs.map(input => input.trim());
|
||||||
|
}
|
||||||
exports.getMultilineInput = getMultilineInput;
|
exports.getMultilineInput = getMultilineInput;
|
||||||
/**
|
/**
|
||||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||||
@@ -274,8 +265,12 @@ exports.getBooleanInput = getBooleanInput;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setOutput(name, value) {
|
function setOutput(name, value) {
|
||||||
|
const filePath = process.env['GITHUB_OUTPUT'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
|
||||||
|
}
|
||||||
process.stdout.write(os.EOL);
|
process.stdout.write(os.EOL);
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
exports.setOutput = setOutput;
|
||||||
/**
|
/**
|
||||||
@@ -404,7 +399,11 @@ exports.group = group;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function saveState(name, value) {
|
function saveState(name, value) {
|
||||||
command_1.issueCommand('save-state', { name }, value);
|
const filePath = process.env['GITHUB_STATE'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
|
||||||
|
}
|
||||||
|
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
|
||||||
}
|
}
|
||||||
exports.saveState = saveState;
|
exports.saveState = saveState;
|
||||||
/**
|
/**
|
||||||
@@ -470,13 +469,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.issueCommand = void 0;
|
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
|
||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
const fs = __importStar(__nccwpck_require__(5747));
|
const fs = __importStar(__nccwpck_require__(5747));
|
||||||
const os = __importStar(__nccwpck_require__(2087));
|
const os = __importStar(__nccwpck_require__(2087));
|
||||||
|
const uuid_1 = __nccwpck_require__(5840);
|
||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
function issueCommand(command, message) {
|
function issueFileCommand(command, message) {
|
||||||
const filePath = process.env[`GITHUB_${command}`];
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
if (!filePath) {
|
if (!filePath) {
|
||||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
@@ -488,7 +488,22 @@ function issueCommand(command, message) {
|
|||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.issueCommand = issueCommand;
|
exports.issueFileCommand = issueFileCommand;
|
||||||
|
function prepareKeyValueMessage(key, value) {
|
||||||
|
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
||||||
|
const convertedValue = utils_1.toCommandValue(value);
|
||||||
|
// These should realistically never happen, but just in case someone finds a
|
||||||
|
// way to exploit uuid generation let's not allow keys or values that contain
|
||||||
|
// the delimiter.
|
||||||
|
if (key.includes(delimiter)) {
|
||||||
|
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
||||||
|
}
|
||||||
|
if (convertedValue.includes(delimiter)) {
|
||||||
|
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
||||||
|
}
|
||||||
|
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
|
||||||
|
}
|
||||||
|
exports.prepareKeyValueMessage = prepareKeyValueMessage;
|
||||||
//# sourceMappingURL=file-command.js.map
|
//# sourceMappingURL=file-command.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -8199,8 +8214,6 @@ module.exports = function getContext() {
|
|||||||
/***/ 2877:
|
/***/ 2877:
|
||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
__nccwpck_require__(4307)
|
|
||||||
|
|
||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const axios = __nccwpck_require__(6545)
|
const axios = __nccwpck_require__(6545)
|
||||||
|
|
||||||
@@ -8662,8 +8675,6 @@ module.exports = require("zlib");
|
|||||||
var __webpack_exports__ = {};
|
var __webpack_exports__ = {};
|
||||||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
||||||
(() => {
|
(() => {
|
||||||
__nccwpck_require__(4307)
|
|
||||||
|
|
||||||
// This package assumes a site has already been built and the files exist in the current workspace
|
// This package assumes a site has already been built and the files exist in the current workspace
|
||||||
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
|
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
|
||||||
// without the user having to do the tar process themselves.
|
// without the user having to do the tar process themselves.
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
transform: {
|
|
||||||
'^.+\\.(js|jsx)$': 'babel-jest'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2718
package-lock.json
generated
2718
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
@@ -4,17 +4,11 @@
|
|||||||
"description": "Deploy an actions artifact to GitHub Pages",
|
"description": "Deploy an actions artifact to GitHub Pages",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/artifact": "^0.5.2",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/core": "^1.9.1",
|
|
||||||
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"regenerator-runtime": "^0.13.9",
|
"axios-retry": "^3.2.4"
|
||||||
"axios-retry": "^3.2.4",
|
|
||||||
"tar": "^6.1.11"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-env": "^7.16.0",
|
|
||||||
"@github/prettier-config": "0.0.4",
|
|
||||||
"@vercel/ncc": "^0.31.1",
|
"@vercel/ncc": "^0.31.1",
|
||||||
"eslint": "^8.2.0",
|
"eslint": "^8.2.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
@@ -24,12 +18,13 @@
|
|||||||
"prettier": "^2.4.1"
|
"prettier": "^2.4.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src",
|
"all": "npm run format && npm run lint && npm run prepare && npm run test",
|
||||||
|
"format": "prettier --write .",
|
||||||
|
"format:check": "prettier --check .",
|
||||||
|
"lint": "DEBUG=eslint:cli-engine eslint --fix .",
|
||||||
|
"lint:check": "DEBUG=eslint:cli-engine eslint .",
|
||||||
"prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt && ncc build src/pre.js -o pre --source-map --license licenses.txt",
|
"prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt && ncc build src/pre.js -o pre --source-map --license licenses.txt",
|
||||||
"test": "jest",
|
"test": "jest"
|
||||||
"format": "prettier --write 'src/**/*.js'",
|
|
||||||
"format:check": "prettier --check 'src/**/*.js'",
|
|
||||||
"all": "npm run format && npm run lint && npm run prepare && npm run test"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
55
pre/index.js
55
pre/index.js
@@ -140,7 +140,6 @@ const file_command_1 = __nccwpck_require__(717);
|
|||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
const os = __importStar(__nccwpck_require__(2087));
|
const os = __importStar(__nccwpck_require__(2087));
|
||||||
const path = __importStar(__nccwpck_require__(5622));
|
const path = __importStar(__nccwpck_require__(5622));
|
||||||
const uuid_1 = __nccwpck_require__(5840);
|
|
||||||
const oidc_utils_1 = __nccwpck_require__(8041);
|
const oidc_utils_1 = __nccwpck_require__(8041);
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
@@ -170,21 +169,10 @@ function exportVariable(name, val) {
|
|||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
const filePath = process.env['GITHUB_ENV'] || '';
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
|
||||||
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
|
|
||||||
if (name.includes(delimiter)) {
|
|
||||||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
|
||||||
}
|
}
|
||||||
if (convertedVal.includes(delimiter)) {
|
|
||||||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
|
||||||
}
|
|
||||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
|
||||||
file_command_1.issueCommand('ENV', commandValue);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
* Registers a secret which will get masked from logs
|
* Registers a secret which will get masked from logs
|
||||||
@@ -201,7 +189,7 @@ exports.setSecret = setSecret;
|
|||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
const filePath = process.env['GITHUB_PATH'] || '';
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
file_command_1.issueCommand('PATH', inputPath);
|
file_command_1.issueFileCommand('PATH', inputPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
@@ -241,8 +229,11 @@ function getMultilineInput(name, options) {
|
|||||||
const inputs = getInput(name, options)
|
const inputs = getInput(name, options)
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(x => x !== '');
|
.filter(x => x !== '');
|
||||||
|
if (options && options.trimWhitespace === false) {
|
||||||
return inputs;
|
return inputs;
|
||||||
}
|
}
|
||||||
|
return inputs.map(input => input.trim());
|
||||||
|
}
|
||||||
exports.getMultilineInput = getMultilineInput;
|
exports.getMultilineInput = getMultilineInput;
|
||||||
/**
|
/**
|
||||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||||
@@ -274,8 +265,12 @@ exports.getBooleanInput = getBooleanInput;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setOutput(name, value) {
|
function setOutput(name, value) {
|
||||||
|
const filePath = process.env['GITHUB_OUTPUT'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
|
||||||
|
}
|
||||||
process.stdout.write(os.EOL);
|
process.stdout.write(os.EOL);
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
exports.setOutput = setOutput;
|
||||||
/**
|
/**
|
||||||
@@ -404,7 +399,11 @@ exports.group = group;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function saveState(name, value) {
|
function saveState(name, value) {
|
||||||
command_1.issueCommand('save-state', { name }, value);
|
const filePath = process.env['GITHUB_STATE'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
|
||||||
|
}
|
||||||
|
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
|
||||||
}
|
}
|
||||||
exports.saveState = saveState;
|
exports.saveState = saveState;
|
||||||
/**
|
/**
|
||||||
@@ -470,13 +469,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.issueCommand = void 0;
|
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
|
||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
const fs = __importStar(__nccwpck_require__(5747));
|
const fs = __importStar(__nccwpck_require__(5747));
|
||||||
const os = __importStar(__nccwpck_require__(2087));
|
const os = __importStar(__nccwpck_require__(2087));
|
||||||
|
const uuid_1 = __nccwpck_require__(5840);
|
||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
function issueCommand(command, message) {
|
function issueFileCommand(command, message) {
|
||||||
const filePath = process.env[`GITHUB_${command}`];
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
if (!filePath) {
|
if (!filePath) {
|
||||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
@@ -488,7 +488,22 @@ function issueCommand(command, message) {
|
|||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.issueCommand = issueCommand;
|
exports.issueFileCommand = issueFileCommand;
|
||||||
|
function prepareKeyValueMessage(key, value) {
|
||||||
|
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
|
||||||
|
const convertedValue = utils_1.toCommandValue(value);
|
||||||
|
// These should realistically never happen, but just in case someone finds a
|
||||||
|
// way to exploit uuid generation let's not allow keys or values that contain
|
||||||
|
// the delimiter.
|
||||||
|
if (key.includes(delimiter)) {
|
||||||
|
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
|
||||||
|
}
|
||||||
|
if (convertedValue.includes(delimiter)) {
|
||||||
|
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
|
||||||
|
}
|
||||||
|
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
|
||||||
|
}
|
||||||
|
exports.prepareKeyValueMessage = prepareKeyValueMessage;
|
||||||
//# sourceMappingURL=file-command.js.map
|
//# sourceMappingURL=file-command.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -8199,8 +8214,6 @@ module.exports = function getContext() {
|
|||||||
/***/ 2877:
|
/***/ 2877:
|
||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
__nccwpck_require__(4307)
|
|
||||||
|
|
||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const axios = __nccwpck_require__(6545)
|
const axios = __nccwpck_require__(6545)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,3 @@
|
|||||||
require('regenerator-runtime/runtime')
|
|
||||||
|
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
require('regenerator-runtime/runtime')
|
|
||||||
|
|
||||||
// This package assumes a site has already been built and the files exist in the current workspace
|
// This package assumes a site has already been built and the files exist in the current workspace
|
||||||
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
|
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
|
||||||
// without the user having to do the tar process themselves.
|
// without the user having to do the tar process themselves.
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ const path = require('path')
|
|||||||
const nock = require('nock')
|
const nock = require('nock')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
|
|
||||||
const { expect, jest } = require('@jest/globals')
|
|
||||||
|
|
||||||
const { Deployment } = require('./deployment')
|
const { Deployment } = require('./deployment')
|
||||||
|
|
||||||
describe('with all environment variables set', () => {
|
describe('with all environment variables set', () => {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ const core = require('@actions/core')
|
|||||||
const process = require('process')
|
const process = require('process')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
|
|
||||||
const { expect, jest } = require('@jest/globals')
|
|
||||||
|
|
||||||
const { emitTelemetry } = require('./pre')
|
const { emitTelemetry } = require('./pre')
|
||||||
|
|
||||||
describe('emitTelemetry', () => {
|
describe('emitTelemetry', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user