Skip to content

Commit

Permalink
Use test timings token when available (vercel#44549)
Browse files Browse the repository at this point in the history
This request occasionally gets a `403` response most likely from rate
limiting inside of GitHub actions so this attempts to increase our rate
limits by using the test timings token when available.

x-ref:
https://github.com/vercel/next.js/actions/runs/3833572871/jobs/6525160878
x-ref:
https://github.com/vercel/next.js/actions/runs/3833158940/attempts/1
  • Loading branch information
ijjk committed Jan 3, 2023
1 parent a25d800 commit c2e0271
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN || secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -317,7 +318,7 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN || secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -379,6 +380,7 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN || secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -429,7 +431,7 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN || secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -481,7 +483,7 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN || secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
Expand Down
6 changes: 5 additions & 1 deletion run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const isTestJob = !!process.env.NEXT_TEST_JOB
const TIMINGS_API = `https://api.github.com/gists/4500dd89ae2f5d70d9aaceb191f528d1`
const TIMINGS_API_HEADERS = {
Accept: 'application/vnd.github.v3+json',
...(process.env.TEST_TIMINGS_TOKEN
? {
Authorization: `Bearer ${process.env.TEST_TIMINGS_TOKEN}`,
}
: {}),
}

const testFilters = {
Expand Down Expand Up @@ -463,7 +468,6 @@ async function main() {
method: 'PATCH',
headers: {
...TIMINGS_API_HEADERS,
Authorization: `Bearer ${process.env.TEST_TIMINGS_TOKEN}`,
},
body: JSON.stringify({
files: {
Expand Down

0 comments on commit c2e0271

Please sign in to comment.