Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using GITHUB_TOKEN to make API requests in scripts/get_env.py #4033

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /runner/_work
FBT_GIT_SUBMODULE_SHALLOW: 1
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
main:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_compact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
env:
FBT_TOOLCHAIN_PATH: /runner/_work
FBT_GIT_SUBMODULE_SHALLOW: 1
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
compact:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
TARGETS: f7
DEFAULT_TARGET: f7
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
check-secret:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/merge_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
FBT_TOOLCHAIN_PATH: /runner/_work
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
merge_report:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pvs_studio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /runner/_work
FBT_GIT_SUBMODULE_SHALLOW: 1
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
analyse_c_cpp:
Expand Down
6 changes: 5 additions & 1 deletion scripts/get_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def get_commit_json(event):
commit_url = event["pull_request"]["base"]["repo"]["commits_url"].replace(
"{/sha}", f"/{event['pull_request']['head']['sha']}"
)
with urllib.request.urlopen(commit_url, context=context) as commit_file:
request = urllib.request.Request(commit_url)
if "GH_TOKEN" in os.environ:
request.add_header("Authorization", "Bearer %s" % (os.environ["GH_TOKEN"]))

with urllib.request.urlopen(request, context=context) as commit_file:
commit_json = json.loads(commit_file.read().decode("utf-8"))
return commit_json

Expand Down
Loading