Skip to content

Commit e7216da

Browse files
authored
Fix: use environment variables for token/username (#5)
Modifying the script every time is annoying, so avoid the need to do that.
1 parent 8555336 commit e7216da

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

backport/backport.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
This assumes your git "origin" points to your fork, and "upstream" to upstream.
66
This will force-push to a branch called "release-backport".
77
8+
The GITHUB_TOKEN is a classic token you need to generate that has public_repo
9+
scope enabled. This token is used to push the backported PRs to GitHub.
10+
811
Execute with:
912
13+
$ export GITHUB_TOKEN=ghp_XXX
14+
$ export GITHUB_USERNAME=XXX
1015
$ python3 .github/backport.py
1116
1217
And follow the instructions. After the PR is merged, run:
@@ -19,11 +24,8 @@
1924
import subprocess
2025
import sys
2126

22-
# NOTE: Replace this with your own token, which must be a classic token that
23-
# has public_repo scope enabled to be able to mark the backported PRs as done.
24-
BEARER_TOKEN = "ghp_???"
25-
# NOTE: Replace this with your own GitHub username
26-
USERNAME = "TrueBrain"
27+
BEARER_TOKEN = os.getenv("GITHUB_TOKEN")
28+
USERNAME = os.getenv("GITHUB_USERNAME")
2729
# NOTE: Replace with the version branch to backport to
2830
RELEASE = "13"
2931

@@ -225,7 +227,7 @@ def main():
225227
print("")
226228
print("Done cherry-picking")
227229
print("Backporting language changes")
228-
res = do_command(["python3", ".github/backport-languages.py"])
230+
res = do_command(["python3", os.path.dirname(os.path.realpath(__file__)) + "/backport-languages.py"])
229231
if res.returncode != 0:
230232
print("ERROR: backporting language changes failed")
231233
return

0 commit comments

Comments
 (0)