Skip to content

Commit c7ea07b

Browse files
Add a secret header to wiki requests (#2631)
1 parent 95db083 commit c7ea07b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/wiki.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ jobs:
2121

2222
- name: Check rules on the wiki page
2323
run: python scripts/check_rules_on_wiki.py -ci
24+
env:
25+
WIKI_TOKEN_GHA: ${{ secrets.WIKI_TOKEN_GHA }}

scripts/check_rules_on_wiki.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ def __init__(self) -> None:
6363
def get_rules_on_wiki_page(self) -> set:
6464
"""Get the list of rules on the wiki page."""
6565
req = Request(self.wiki_page_url)
66+
67+
# When running on GitHub Actions, we need to add the token to the request
68+
# to access the wiki page. Otherwise, we get a 403 error.
69+
wiki_token = os.environ.get("WIKI_TOKEN_GHA")
70+
if wiki_token:
71+
req.add_header("bugbotgha", wiki_token)
72+
6673
with urlopen(req) as resp:
6774
wiki_page_content = resp.read().decode("utf-8")
6875

0 commit comments

Comments
 (0)