Add possibility to alter the target repository

This commit is contained in:
Alejandro Hernández 2020-02-06 19:22:07 +01:00
parent b7064071dc
commit f092a452c6
No known key found for this signature in database
GPG key ID: A678768B568EF2D9
6 changed files with 11 additions and 2 deletions

2
dist/index.js vendored
View file

@ -1027,6 +1027,7 @@ async function run() {
const inputs = {
token: core.getInput("token"),
path: core.getInput("path"),
repository: core.getInput("repository"),
commitMessage: core.getInput("commit-message"),
committer: core.getInput("committer"),
author: core.getInput("author"),
@ -1047,6 +1048,7 @@ async function run() {
// Set environment variables from inputs.
if (inputs.token) process.env.GITHUB_TOKEN = inputs.token;
if (inputs.repository) process.env.CPR_REPOSITORY = inputs.repository;
if (inputs.path) process.env.CPR_PATH = inputs.path;
if (inputs.commitMessage) process.env.CPR_COMMIT_MESSAGE = inputs.commitMessage;
if (inputs.committer) process.env.CPR_COMMITTER = inputs.committer;

View file

@ -22,6 +22,7 @@ DEFAULT_BODY = (
+ "[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action"
)
DEFAULT_BRANCH = "create-pull-request/patch"
DEFAULT_REPOSITORY = os.environ["GITHUB_REPOSITORY"]
def get_git_config_value(repo, name):
@ -94,7 +95,7 @@ def set_committer_author(repo, committer, author):
# Get required environment variables
github_token = os.environ["GITHUB_TOKEN"]
github_repository = os.environ["GITHUB_REPOSITORY"]
github_repository = os.getenv("CPR_REPOSITORY", DEFAULT_REPOSITORY)
# Get environment variables with defaults
path = os.getenv("CPR_PATH", os.getcwd())
branch = os.getenv("CPR_BRANCH", DEFAULT_BRANCH)