Skip to content

Commit ef39af3

Browse files
committed
[WIP] ci: Disable uploading cached source files on pull request
The pull request CI now uses the `pull_request` event type instead of the `pull_request_target` event type, and therefore no longer has access to the repository secrets. The `cache-sdk` S3 bucket is now public read-only and may be downloaded without an AWS credential. The cache upload is only done in non-pull request CI runs (mainly, on push). Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent f37c0c5 commit ef39af3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ jobs:
598598
path: ${{ runner.temp }}
599599

600600
- name: Configure AWS Credentials
601+
if: ${{ github.event_name != 'pull_request' }}
601602
uses: aws-actions/configure-aws-credentials@v4
602603
with:
603604
aws-access-key-id: ${{ secrets.AWS_CACHE_SDK_ACCESS_KEY_ID }}
@@ -614,7 +615,7 @@ jobs:
614615
# Download cached source files
615616
mkdir -p ${WORKSPACE}/sources
616617
pushd ${WORKSPACE}/sources
617-
aws s3 sync ${SRC_CACHE_URI} .
618+
aws s3 sync --no-sign-request ${SRC_CACHE_URI} .
618619
popd
619620
620621
# Export environment variables
@@ -773,6 +774,7 @@ jobs:
773774
limit-access-to-actor: true
774775

775776
- name: Sync downloaded source files to cache
777+
if: ${{ github.event_name != 'pull_request' }}
776778
continue-on-error: true
777779
run: |
778780
pushd ${WORKSPACE}/sources
@@ -1059,6 +1061,7 @@ jobs:
10591061
git submodule update --depth=1 --recursive openocd
10601062
10611063
- name: Configure AWS Credentials
1064+
if: ${{ github.event_name != 'pull_request' }}
10621065
uses: aws-actions/configure-aws-credentials@v4
10631066
with:
10641067
aws-access-key-id: ${{ secrets.AWS_CACHE_SDK_ACCESS_KEY_ID }}
@@ -1077,7 +1080,7 @@ jobs:
10771080
# Download cached source files
10781081
mkdir -p ${POKY_DOWNLOADS}
10791082
pushd ${POKY_DOWNLOADS}
1080-
aws s3 sync ${SRC_CACHE_URI} .
1083+
aws s3 sync --no-sign-request ${SRC_CACHE_URI} .
10811084
popd
10821085
10831086
# Export environment variables
@@ -1227,7 +1230,7 @@ jobs:
12271230
limit-access-to-actor: true
12281231

12291232
- name: Sync downloaded source files to cache (Linux)
1230-
if: startsWith(matrix.host.name, 'linux-')
1233+
if: ${{ github.event_name != 'pull_request' }} && startsWith(matrix.host.name, 'linux-')
12311234
continue-on-error: true
12321235
run: |
12331236
pushd ${POKY_DOWNLOADS}

0 commit comments

Comments
 (0)