mirror of
https://github.com/actions/upload-artifact.git
synced 2025-04-20 09:36:46 +00:00
add token parameter
This commit is contained in:
parent
a52618175f
commit
18c9955185
5 changed files with 14 additions and 6 deletions
9
dist/index.js
vendored
9
dist/index.js
vendored
|
@ -5553,7 +5553,7 @@ function run() {
|
||||||
const unsignedUrl = `${response.data.value[0].url}`;
|
const unsignedUrl = `${response.data.value[0].url}`;
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
console.log(`unsigned artifact url is ${unsignedUrl}`);
|
console.log(`unsigned artifact url is ${unsignedUrl}`);
|
||||||
if (!process.env.GITHUB_TOKEN) {
|
if (!inputs.token) {
|
||||||
console.log("missing github token");
|
console.log("missing github token");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -5564,7 +5564,7 @@ function run() {
|
||||||
headers: {
|
headers: {
|
||||||
"Accept": "application/vnd.github.v3+json",
|
"Accept": "application/vnd.github.v3+json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
|
"Authorization": `Bearer ${inputs.token}}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
|
@ -9113,6 +9113,7 @@ const constants_1 = __webpack_require__(694);
|
||||||
function getInputs() {
|
function getInputs() {
|
||||||
const name = core.getInput(constants_1.Inputs.Name);
|
const name = core.getInput(constants_1.Inputs.Name);
|
||||||
const path = core.getInput(constants_1.Inputs.Path, { required: true });
|
const path = core.getInput(constants_1.Inputs.Path, { required: true });
|
||||||
|
const token = core.getInput(constants_1.Inputs.Token);
|
||||||
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
|
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
|
||||||
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
|
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
|
||||||
if (!noFileBehavior) {
|
if (!noFileBehavior) {
|
||||||
|
@ -9121,7 +9122,8 @@ function getInputs() {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
artifactName: name,
|
artifactName: name,
|
||||||
searchPath: path,
|
searchPath: path,
|
||||||
ifNoFilesFound: noFileBehavior
|
ifNoFilesFound: noFileBehavior,
|
||||||
|
token: token
|
||||||
};
|
};
|
||||||
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
|
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
|
||||||
if (retentionDaysStr) {
|
if (retentionDaysStr) {
|
||||||
|
@ -10729,6 +10731,7 @@ var Inputs;
|
||||||
(function (Inputs) {
|
(function (Inputs) {
|
||||||
Inputs["Name"] = "name";
|
Inputs["Name"] = "name";
|
||||||
Inputs["Path"] = "path";
|
Inputs["Path"] = "path";
|
||||||
|
Inputs["Token"] = "token";
|
||||||
Inputs["IfNoFilesFound"] = "if-no-files-found";
|
Inputs["IfNoFilesFound"] = "if-no-files-found";
|
||||||
Inputs["RetentionDays"] = "retention-days";
|
Inputs["RetentionDays"] = "retention-days";
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export enum Inputs {
|
export enum Inputs {
|
||||||
Name = 'name',
|
Name = 'name',
|
||||||
Path = 'path',
|
Path = 'path',
|
||||||
|
Token = 'token',
|
||||||
IfNoFilesFound = 'if-no-files-found',
|
IfNoFilesFound = 'if-no-files-found',
|
||||||
RetentionDays = 'retention-days'
|
RetentionDays = 'retention-days'
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {UploadInputs} from './upload-inputs'
|
||||||
export function getInputs(): UploadInputs {
|
export function getInputs(): UploadInputs {
|
||||||
const name = core.getInput(Inputs.Name)
|
const name = core.getInput(Inputs.Name)
|
||||||
const path = core.getInput(Inputs.Path, {required: true})
|
const path = core.getInput(Inputs.Path, {required: true})
|
||||||
|
const token = core.getInput(Inputs.Token)
|
||||||
|
|
||||||
const ifNoFilesFound = core.getInput(Inputs.IfNoFilesFound)
|
const ifNoFilesFound = core.getInput(Inputs.IfNoFilesFound)
|
||||||
const noFileBehavior: NoFileOptions = NoFileOptions[ifNoFilesFound]
|
const noFileBehavior: NoFileOptions = NoFileOptions[ifNoFilesFound]
|
||||||
|
@ -25,7 +26,8 @@ export function getInputs(): UploadInputs {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
artifactName: name,
|
artifactName: name,
|
||||||
searchPath: path,
|
searchPath: path,
|
||||||
ifNoFilesFound: noFileBehavior
|
ifNoFilesFound: noFileBehavior,
|
||||||
|
token: token
|
||||||
} as UploadInputs
|
} as UploadInputs
|
||||||
|
|
||||||
const retentionDaysStr = core.getInput(Inputs.RetentionDays)
|
const retentionDaysStr = core.getInput(Inputs.RetentionDays)
|
||||||
|
|
|
@ -78,7 +78,7 @@ async function run(): Promise<void> {
|
||||||
const unsignedUrl = `${response.data.value[0].url}`
|
const unsignedUrl = `${response.data.value[0].url}`
|
||||||
console.log(response.data)
|
console.log(response.data)
|
||||||
console.log(`unsigned artifact url is ${unsignedUrl}`)
|
console.log(`unsigned artifact url is ${unsignedUrl}`)
|
||||||
if (!process.env.GITHUB_TOKEN) {
|
if (!inputs.token) {
|
||||||
console.log("missing github token")
|
console.log("missing github token")
|
||||||
} else {
|
} else {
|
||||||
response = await axios.post("https://api.github.com/repos/github/hub/pages/deployment", {
|
response = await axios.post("https://api.github.com/repos/github/hub/pages/deployment", {
|
||||||
|
@ -88,7 +88,7 @@ async function run(): Promise<void> {
|
||||||
headers: {
|
headers: {
|
||||||
"Accept": "application/vnd.github.v3+json",
|
"Accept": "application/vnd.github.v3+json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
|
"Authorization": `Bearer ${inputs.token}}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(response.data)
|
console.log(response.data)
|
||||||
|
|
|
@ -20,4 +20,6 @@ export interface UploadInputs {
|
||||||
* Duration after which artifact will expire in days
|
* Duration after which artifact will expire in days
|
||||||
*/
|
*/
|
||||||
retentionDays: number
|
retentionDays: number
|
||||||
|
|
||||||
|
token: string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue