Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
305373e8f3 | |||
04bf3d439a | |||
ec6352b0a0 | |||
ce4df54075 | |||
c855a500d1 | |||
baf52378ae |
2
.github/workflows/slash-command-dispatch.yml
vendored
2
.github/workflows/slash-command-dispatch.yml
vendored
@ -11,6 +11,6 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||
reaction-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commands: test
|
||||
commands: test, clean
|
||||
permission: admin
|
||||
repository: peter-evans/create-pull-request-tests
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -965,7 +965,7 @@ async function run() {
|
||||
core.debug(`src: ${src}`);
|
||||
|
||||
// Setup Python from the tool cache
|
||||
setupPython("3.8.0", "x64");
|
||||
setupPython("3.8.x", "x64");
|
||||
|
||||
// Install requirements
|
||||
await exec.exec("pip", [
|
||||
|
19
dist/src/create-pull-request.py
vendored
19
dist/src/create-pull-request.py
vendored
@ -44,12 +44,8 @@ def get_author_default(event_name, event_data):
|
||||
return email, name
|
||||
|
||||
|
||||
def set_git_remote_url(git, token, github_repository):
|
||||
git.remote(
|
||||
"set-url",
|
||||
"origin",
|
||||
"https://x-access-token:%s@github.com/%s" % (token, github_repository),
|
||||
)
|
||||
def get_repo_url(token, github_repository):
|
||||
return "https://x-access-token:%s@github.com/%s" % (token, github_repository)
|
||||
|
||||
|
||||
def checkout_branch(git, remote_exists, branch):
|
||||
@ -67,10 +63,11 @@ def checkout_branch(git, remote_exists, branch):
|
||||
git.checkout("HEAD", b=branch)
|
||||
|
||||
|
||||
def push_changes(git, branch, commit_message):
|
||||
def push_changes(git, token, github_repository, branch, commit_message):
|
||||
git.add("-A")
|
||||
git.commit(m=commit_message)
|
||||
return git.push("-f", "--set-upstream", "origin", branch)
|
||||
repo_url = get_repo_url(token, github_repository)
|
||||
return git.push("-f", repo_url, f"HEAD:refs/heads/{branch}")
|
||||
|
||||
|
||||
def cs_string_to_list(str):
|
||||
@ -135,7 +132,9 @@ def process_event(github_token, github_repository, repo, branch, base):
|
||||
|
||||
# Push the local changes to the remote branch
|
||||
print("Pushing changes to 'origin/%s'" % branch)
|
||||
push_result = push_changes(repo.git, branch, commit_message)
|
||||
push_result = push_changes(
|
||||
repo.git, github_token, github_repository, branch, commit_message
|
||||
)
|
||||
print(push_result)
|
||||
|
||||
# Create the pull request
|
||||
@ -243,8 +242,6 @@ repo.git.update_environment(
|
||||
GIT_COMMITTER_NAME=committer_name,
|
||||
GIT_COMMITTER_EMAIL=committer_email,
|
||||
)
|
||||
# Update URL for the 'origin' remote
|
||||
set_git_remote_url(repo.git, github_token, github_repository)
|
||||
|
||||
# Fetch/Set the branch name
|
||||
branch_prefix = os.getenv("PULL_REQUEST_BRANCH", "create-pull-request/patch")
|
||||
|
2
index.js
2
index.js
@ -10,7 +10,7 @@ async function run() {
|
||||
core.debug(`src: ${src}`);
|
||||
|
||||
// Setup Python from the tool cache
|
||||
setupPython("3.8.0", "x64");
|
||||
setupPython("3.8.x", "x64");
|
||||
|
||||
// Install requirements
|
||||
await exec.exec("pip", [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-pull-request",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"description": "Creates a pull request for changes to your repository in the actions workspace",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -44,12 +44,8 @@ def get_author_default(event_name, event_data):
|
||||
return email, name
|
||||
|
||||
|
||||
def set_git_remote_url(git, token, github_repository):
|
||||
git.remote(
|
||||
"set-url",
|
||||
"origin",
|
||||
"https://x-access-token:%s@github.com/%s" % (token, github_repository),
|
||||
)
|
||||
def get_repo_url(token, github_repository):
|
||||
return "https://x-access-token:%s@github.com/%s" % (token, github_repository)
|
||||
|
||||
|
||||
def checkout_branch(git, remote_exists, branch):
|
||||
@ -67,10 +63,11 @@ def checkout_branch(git, remote_exists, branch):
|
||||
git.checkout("HEAD", b=branch)
|
||||
|
||||
|
||||
def push_changes(git, branch, commit_message):
|
||||
def push_changes(git, token, github_repository, branch, commit_message):
|
||||
git.add("-A")
|
||||
git.commit(m=commit_message)
|
||||
return git.push("-f", "--set-upstream", "origin", branch)
|
||||
repo_url = get_repo_url(token, github_repository)
|
||||
return git.push("-f", repo_url, f"HEAD:refs/heads/{branch}")
|
||||
|
||||
|
||||
def cs_string_to_list(str):
|
||||
@ -135,7 +132,9 @@ def process_event(github_token, github_repository, repo, branch, base):
|
||||
|
||||
# Push the local changes to the remote branch
|
||||
print("Pushing changes to 'origin/%s'" % branch)
|
||||
push_result = push_changes(repo.git, branch, commit_message)
|
||||
push_result = push_changes(
|
||||
repo.git, github_token, github_repository, branch, commit_message
|
||||
)
|
||||
print(push_result)
|
||||
|
||||
# Create the pull request
|
||||
@ -243,8 +242,6 @@ repo.git.update_environment(
|
||||
GIT_COMMITTER_NAME=committer_name,
|
||||
GIT_COMMITTER_EMAIL=committer_email,
|
||||
)
|
||||
# Update URL for the 'origin' remote
|
||||
set_git_remote_url(repo.git, github_token, github_repository)
|
||||
|
||||
# Fetch/Set the branch name
|
||||
branch_prefix = os.getenv("PULL_REQUEST_BRANCH", "create-pull-request/patch")
|
||||
|
Reference in New Issue
Block a user