ci: use GITHUB_TOKEN for roulette api calls (#19537)
This is safe cuz we set read only permission on this token in workflows. NOTE: Changing permission type is dangerous here!
This commit is contained in:
parent
3e715985c6
commit
f5771baf66
4 changed files with 12 additions and 1 deletions
7
.github/helper/roulette.py
vendored
7
.github/helper/roulette.py
vendored
|
|
@ -23,10 +23,15 @@ def fetch_pr_data(pr_number, repo, endpoint=""):
|
|||
|
||||
def req(url):
|
||||
"Simple resilient request call to handle rate limits."
|
||||
headers = None
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
if token:
|
||||
headers = {"authorization": f"Bearer {token}"}
|
||||
|
||||
retries = 0
|
||||
while True:
|
||||
try:
|
||||
req = urllib.request.Request(url)
|
||||
req = urllib.request.Request(url, headers=headers)
|
||||
return urllib.request.urlopen(req)
|
||||
except HTTPError as exc:
|
||||
if exc.code == 403 and retries < 5:
|
||||
|
|
|
|||
2
.github/workflows/patch-mariadb-tests.yml
vendored
2
.github/workflows/patch-mariadb-tests.yml
vendored
|
|
@ -9,6 +9,7 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
# Do not change this as GITHUB_TOKEN is being used by roulette
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
|
|
@ -31,6 +32,7 @@ jobs:
|
|||
TYPE: "server"
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
test:
|
||||
name: Patch
|
||||
|
|
|
|||
2
.github/workflows/server-tests.yml
vendored
2
.github/workflows/server-tests.yml
vendored
|
|
@ -12,6 +12,7 @@ concurrency:
|
|||
|
||||
|
||||
permissions:
|
||||
# Do not change this as GITHUB_TOKEN is being used by roulette
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
|
|
@ -34,6 +35,7 @@ jobs:
|
|||
TYPE: "server"
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
test:
|
||||
name: Unit Tests
|
||||
|
|
|
|||
2
.github/workflows/ui-tests.yml
vendored
2
.github/workflows/ui-tests.yml
vendored
|
|
@ -11,6 +11,7 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
# Do not change this as GITHUB_TOKEN is being used by roulette
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
|
|
@ -33,6 +34,7 @@ jobs:
|
|||
TYPE: "ui"
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue