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