Skip to content

Commit

Permalink
Fix: add_label_to_issue encountered an HTTPError: 403 Client Error: F…
Browse files Browse the repository at this point in the history
…orbidden for url
  • Loading branch information
hiroshinishio committed Jul 8, 2024
1 parent db8762c commit 65ada61
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Run pytest
env:
GH_APP_ID: ${{ secrets.PROD_GH_APP_ID }}
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
GH_APP_USER_ID: ${{ secrets.GH_APP_USER_ID }}
GH_APP_USER_NAME: ${{ secrets.GH_APP_USER_NAME }}
GH_PRIVATE_KEY: ${{ secrets.PROD_GH_PRIVATE_KEY }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stage-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- name: Run pytest
env:
GH_APP_ID: ${{ secrets.STAGE_GH_APP_ID }}
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
GH_APP_USER_ID: ${{ secrets.GH_APP_USER_ID }}
GH_APP_USER_NAME: ${{ secrets.GH_APP_USER_NAME }}
GH_PRIVATE_KEY: ${{ secrets.STAGE_GH_PRIVATE_KEY }}
Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def get_env_var(name: str) -> str:
844909, # Production
901480 # Staging
]))
GITHUB_APP_NAME: str = get_env_var(name="GH_APP_NAME")
GITHUB_APP_USER_ID: int = int(get_env_var(name="GH_APP_USER_ID"))
GITHUB_APP_USER_NAME: str = get_env_var(name="GH_APP_USER_NAME")
GITHUB_PRIVATE_KEY_ENCODED: str = get_env_var(name="GH_PRIVATE_KEY")
Expand Down
3 changes: 3 additions & 0 deletions services/github/github_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
GITHUB_API_VERSION,
GITHUB_APP_ID,
GITHUB_APP_IDS,
GITHUB_APP_NAME,
GITHUB_PRIVATE_KEY,
PRODUCT_NAME,
PRODUCT_URL,
Expand Down Expand Up @@ -255,9 +256,11 @@ def create_comment_on_issue_with_gitauto_button(payload: GitHubLabeledPayload) -


def create_headers(token: str) -> dict[str, str]:
"""https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api?apiVersion=2022-11-28#headers"""
return {
"Accept": "application/vnd.github.v3+json",
"Authorization": f"Bearer {token}",
"User-Agent": GITHUB_APP_NAME,
"X-GitHub-Api-Version": GITHUB_API_VERSION,
}

Expand Down

0 comments on commit 65ada61

Please sign in to comment.