Skip to content

Commit 49e9ede

Browse files
authored
Add GitHub token to Cocoapods Github URL to avoid throttling. (#727)
* Add GitHub token to Cocoapods Github URL to avoid throttling. * Use github.token instead of ${GITHUB_TOKEN}; fix URL. * Only temporarily modify the repo URL to include the token. Otherwise, Cocoapods loses track of which repo this is and attempts to fetch it again when you run pod install. * Add GITHUB_TOKEN env var to other workflows.
1 parent b6c496b commit 49e9ede

File tree

5 files changed

+68
-2
lines changed

5 files changed

+68
-2
lines changed

.github/workflows/android.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
env:
1414
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
15+
GITHUB_TOKEN: ${{ github.token }}
1516

1617
jobs:
1718
prepare_matrix:
@@ -45,6 +46,13 @@ jobs:
4546
architecture: ${{ fromJson(needs.prepare_matrix.outputs.matrix_architecture) }}
4647
python_version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version) }}
4748
steps:
49+
- name: Store git credentials for all git commands
50+
# Forces all git commands to use authenticated https, to prevent throttling.
51+
shell: bash
52+
run: |
53+
git config --global credential.helper 'store --file /tmp/git-credentials'
54+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
55+
4856
- name: Check expanded matrix config
4957
if: github.event.inputs.expanded_matrix == '1'
5058
run: |

.github/workflows/cpp-packaging.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ env:
3737
xcodeVersion: "12.2"
3838
# LLVM version with ARM MachO support has no version number yet.
3939
llvmVer: "5f187f0afaad33013ba03454c4749d99b1362534"
40+
GITHUB_TOKEN: ${{ github.token }}
4041

4142
jobs:
4243
log_inputs:
@@ -182,6 +183,13 @@ jobs:
182183
runs-on: macos-latest
183184
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
184185
steps:
186+
- name: Store git credentials for all git commands
187+
# Forces all git commands to use authenticated https, to prevent throttling.
188+
shell: bash
189+
run: |
190+
git config --global credential.helper 'store --file /tmp/git-credentials'
191+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
192+
185193
- name: setup Xcode version (macos)
186194
if: runner.os == 'macOS'
187195
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
@@ -242,6 +250,13 @@ jobs:
242250
with:
243251
path: sdk-src
244252

253+
- name: Store git credentials for all git commands
254+
# Forces all git commands to use authenticated https, to prevent throttling.
255+
shell: bash
256+
run: |
257+
git config --global credential.helper 'store --file /tmp/git-credentials'
258+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
259+
245260
- name: Cache NDK
246261
id: cache_ndk
247262
uses: actions/cache@v2
@@ -333,6 +348,13 @@ jobs:
333348
architecture: "arm64"
334349

335350
steps:
351+
- name: Store git credentials for all git commands
352+
# Forces all git commands to use authenticated https, to prevent throttling.
353+
shell: bash
354+
run: |
355+
git config --global credential.helper 'store --file /tmp/git-credentials'
356+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
357+
336358
- name: setup Xcode version (macos)
337359
if: runner.os == 'macOS'
338360
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer

.github/workflows/desktop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
env:
1414
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
15+
GITHUB_TOKEN: ${{ github.token }}
1516

1617
jobs:
1718
prepare_matrix:
@@ -85,6 +86,13 @@ jobs:
8586
- xcode_version: "11.7"
8687
architecture: "arm64"
8788
steps:
89+
- name: Store git credentials for all git commands
90+
# Forces all git commands to use authenticated https, to prevent throttling.
91+
shell: bash
92+
run: |
93+
git config --global credential.helper 'store --file /tmp/git-credentials'
94+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
95+
8896
- name: Setup Xcode version (macos)
8997
if: runner.os == 'macOS'
9098
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer

.github/workflows/integration_tests.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ env:
4747
statusCommentIdentifier: "integration-test-status-comment"
4848
pythonVersion: '3.7'
4949
artifactRetentionDays: 2
50+
GITHUB_TOKEN: ${{ github.token }}
5051

5152
jobs:
5253
check_and_prepare:
@@ -69,8 +70,6 @@ jobs:
6970
uses: lannonbr/[email protected]
7071
with:
7172
permission: "admin"
72-
env:
73-
GITHUB_TOKEN: ${{ github.token }}
7473
### It sets "github_ref,trigger,pr_number,requested_tests" outputs to control the following jobs and steps
7574
### trigger value: manual_trigger, scheduled_trigger, label_trigger, postsubmit_trigger
7675
- id: set_outputs
@@ -213,6 +212,12 @@ jobs:
213212
with:
214213
ref: ${{needs.check_and_prepare.outputs.github_ref}}
215214
submodules: true
215+
- name: Store git credentials for all git commands
216+
# Forces all git commands to use authenticated https, to prevent throttling.
217+
shell: bash
218+
run: |
219+
git config --global credential.helper 'store --file /tmp/git-credentials'
220+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
216221
- name: Set env vars (Linux)
217222
if: startsWith(matrix.os, 'ubuntu')
218223
run: echo "VCPKG_TRIPLET=x64-linux" >> $GITHUB_ENV
@@ -386,6 +391,12 @@ jobs:
386391
with:
387392
ref: ${{needs.check_and_prepare.outputs.github_ref}}
388393
submodules: true
394+
- name: Store git credentials for all git commands
395+
# Forces all git commands to use authenticated https, to prevent throttling.
396+
shell: bash
397+
run: |
398+
git config --global credential.helper 'store --file /tmp/git-credentials'
399+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
389400
- name: Add msbuild to PATH (Windows)
390401
if: startsWith(matrix.os, 'windows')
391402
uses: microsoft/[email protected]
@@ -501,6 +512,12 @@ jobs:
501512
with:
502513
ref: ${{needs.check_and_prepare.outputs.github_ref}}
503514
submodules: true
515+
- name: Store git credentials for all git commands
516+
# Forces all git commands to use authenticated https, to prevent throttling.
517+
shell: bash
518+
run: |
519+
git config --global credential.helper 'store --file /tmp/git-credentials'
520+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
504521
- name: Setup python
505522
uses: actions/setup-python@v2
506523
with:

.github/workflows/ios.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
description: 'Use an expanded matrix?'
1010
default: '0'
1111
required: true
12+
13+
env:
14+
GITHUB_TOKEN: ${{ github.token }}
15+
1216
jobs:
1317
prepare_matrix:
1418
runs-on: ubuntu-latest
@@ -35,6 +39,13 @@ jobs:
3539
matrix:
3640
xcode_verison: ${{ fromJson(needs.prepare_matrix.outputs.matrix_xcode_version) }}
3741
steps:
42+
- name: Store git credentials for all git commands
43+
# Forces all git commands to use authenticated https, to prevent throttling.
44+
shell: bash
45+
run: |
46+
git config --global credential.helper 'store --file /tmp/git-credentials'
47+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
48+
3849
- name: setup Xcode version (macos)
3950
if: runner.os == 'macOS'
4051
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_verison }}.app/Contents/Developer

0 commit comments

Comments
 (0)