mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
Update action to hybrid multi platform
This commit is contained in:
parent
d99b58f9d5
commit
55e7b1ec28
13 changed files with 5087 additions and 23 deletions
66
index.js
Normal file
66
index.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
const { inspect } = require("util");
|
||||
const core = require("@actions/core");
|
||||
const exec = require("@actions/exec");
|
||||
const setupPython = require("./src/setup-python");
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
// Allows ncc to find assets to be included in the distribution
|
||||
const src = __dirname + "/src";
|
||||
core.debug(`src: ${src}`);
|
||||
|
||||
// Setup Python from the tool cache
|
||||
setupPython("3.8.0", "x64");
|
||||
|
||||
// Install requirements
|
||||
await exec.exec("pip", [
|
||||
"install",
|
||||
"--requirement",
|
||||
`${src}/requirements.txt`
|
||||
]);
|
||||
|
||||
// Fetch action inputs
|
||||
const inputs = {
|
||||
token: core.getInput("token"),
|
||||
commitMessage: core.getInput("commit-message"),
|
||||
commitAuthorEmail: core.getInput("author-email"),
|
||||
commitAuthorName: core.getInput("author-name"),
|
||||
title: core.getInput("title"),
|
||||
body: core.getInput("body"),
|
||||
labels: core.getInput("labels"),
|
||||
assignees: core.getInput("assignees"),
|
||||
reviewers: core.getInput("reviewers"),
|
||||
teamReviewers: core.getInput("team-reviewers"),
|
||||
milestone: core.getInput("milestone"),
|
||||
branch: core.getInput("branch"),
|
||||
base: core.getInput("base"),
|
||||
branchSuffix: core.getInput("branch-suffix"),
|
||||
debugEvent: core.getInput("debug-event")
|
||||
};
|
||||
core.debug(`Inputs: ${inspect(inputs)}`);
|
||||
|
||||
// Set environment variables from inputs.
|
||||
if (inputs.token) process.env.GITHUB_TOKEN = inputs.token;
|
||||
if (inputs.commitMessage) process.env.COMMIT_MESSAGE = inputs.commitMessage;
|
||||
if (inputs.commitAuthorEmail) process.env.COMMIT_AUTHOR_EMAIL = inputs.commitAuthorEmail;
|
||||
if (inputs.commitAuthorName) process.env.COMMIT_AUTHOR_NAME = inputs.commitAuthorName;
|
||||
if (inputs.title) process.env.PULL_REQUEST_TITLE = inputs.title;
|
||||
if (inputs.body) process.env.PULL_REQUEST_BODY = inputs.body;
|
||||
if (inputs.labels) process.env.PULL_REQUEST_LABELS = inputs.labels;
|
||||
if (inputs.assignees) process.env.PULL_REQUEST_ASSIGNEES = inputs.assignees;
|
||||
if (inputs.reviewers) process.env.PULL_REQUEST_REVIEWERS = inputs.reviewers;
|
||||
if (inputs.teamReviewers) process.env.PULL_REQUEST_TEAM_REVIEWERS = inputs.teamReviewers;
|
||||
if (inputs.milestone) process.env.PULL_REQUEST_MILESTONE = inputs.milestone;
|
||||
if (inputs.branch) process.env.PULL_REQUEST_BRANCH = inputs.branch;
|
||||
if (inputs.base) process.env.PULL_REQUEST_BASE = inputs.base;
|
||||
if (inputs.branchSuffix) process.env.BRANCH_SUFFIX = inputs.branchSuffix;
|
||||
if (inputs.debugEvent) process.env.DEBUG_EVENT = inputs.debugEvent;
|
||||
|
||||
// Execute python script
|
||||
await exec.exec("python", [`${src}/create-pull-request.py`]);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
Loading…
Add table
Add a link
Reference in a new issue