Skip to content

Commit

Permalink
Add missing Authorization header to API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Jan 5, 2023
1 parent 0ef4704 commit 300b6fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ runs:
--spec '${{ github.action_path }}'
label-doconly-changes
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
3 changes: 3 additions & 0 deletions src/label_doconly_changes/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PullRequestInfo:
repo_full_name: str
number: int
labels: set[str]
token: str


class App:
Expand Down Expand Up @@ -83,6 +84,7 @@ def from_environ(cls) -> App:
label_data["name"]
for label_data in event_data["pull_request"]["labels"]
},
token=os.environ["GITHUB_TOKEN"],
)

return cls(
Expand Down Expand Up @@ -152,6 +154,7 @@ def run(self) -> int:
return self.exit_code

session = requests.Session()
session.headers["Authorization"] = f"Bearer {self.pr_info.token}"
labels = set(self.options["labels"].split(","))
try:
base_url = BASE_URL.format(
Expand Down

0 comments on commit 300b6fd

Please sign in to comment.