Skip to content

Commit 9d998cb

Browse files
committed
Remove need for repo scoped token
1 parent baab166 commit 9d998cb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/workflows/push.yml renamed to .github/workflows/repository_dispatch.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
on: push
1+
on:
2+
repository_dispatch:
3+
types: [test]
24
name: create-pull-request action testing workflow
35
jobs:
46
createPullRequest:
@@ -14,7 +16,6 @@ jobs:
1416
uses: ./
1517
env:
1618
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17-
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
1819
COMMIT_MESSAGE: Add report file
1920
PULL_REQUEST_BODY: This PR is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request).
2021
PULL_REQUEST_BRANCH: test-patches

create-pull-request.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def set_git_config(git, email, name):
6060

6161

6262
def set_git_remote_url(git, token, github_repository):
63-
git.remote('set-url', 'origin', "https://%s:x-oauth-basic@github.com/%s" % (token, github_repository))
63+
git.remote('set-url', 'origin', "https://x-access-token:%s@github.com/%s" % (token, github_repository))
6464

6565

6666
def commit_changes(git, branch, commit_message):
@@ -82,7 +82,6 @@ def process_event(event_name, event_data, repo, branch, base):
8282
# Fetch required environment variables
8383
github_token = os.environ['GITHUB_TOKEN']
8484
github_repository = os.environ['GITHUB_REPOSITORY']
85-
repo_access_token = os.environ['REPO_ACCESS_TOKEN']
8685
# Fetch remaining optional environment variables
8786
commit_message = os.getenv(
8887
'COMMIT_MESSAGE',
@@ -99,7 +98,7 @@ def process_event(event_name, event_data, repo, branch, base):
9998
# Set git configuration
10099
set_git_config(repo.git, author_email, author_name)
101100
# Update URL for the 'origin' remote
102-
set_git_remote_url(repo.git, repo_access_token, github_repository)
101+
set_git_remote_url(repo.git, github_token, github_repository)
103102

104103
# Commit the repository changes
105104
print("Committing changes.")

0 commit comments

Comments
 (0)