Skip to content

Commit 5642acf

Browse files
authored
Adjust GitHub-Actions to work with PRs from forked repositories (#21)
* Add `pull_request_target` GHA trigger and use `trusted-checkout` action To also run GHA jobs for pull requests from forked repositories, add a new `pull_request_target` trigger. With this trigger, GHA runs do not have restricted privileges (so they are able to push images for example) but, by default, the runs will be based on the target repository instead of the pull request's content. To still checkout the pull request's content, consistently use the `trusted-checkout` action which will do a manual checkout of the PR in case the author is either `COLLABORATOR`, `MEMBER` or `OWNER`. * Use more stable `v1` branch instead of `master` for GHA from cc-utils --------- Signed-off-by: Jonas Brand (8R0WNI3) <j.brand@sap.com>
1 parent f0db4a1 commit 5642acf

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
1414
jobs:
1515
prepare:
16-
uses: gardener/cc-utils/.github/workflows/prepare.yaml@master
16+
uses: gardener/cc-utils/.github/workflows/prepare.yaml@v1
1717
permissions:
1818
id-token: write
1919
with:
@@ -26,7 +26,7 @@ jobs:
2626
permissions:
2727
contents: read
2828
steps:
29-
- uses: actions/checkout@v6
29+
- uses: gardener/cc-utils/.github/actions/trusted-checkout@v1
3030
- name: Export odg-extension-definitions
3131
run: |
3232
export version=${{ needs.prepare.outputs.version }}
@@ -42,7 +42,7 @@ jobs:
4242
4343
tar czf ${blobs_dir}/extension_definitions.tar.gz ${extension_definitions}
4444
45-
- uses: gardener/cc-utils/.github/actions/export-ocm-fragments@master
45+
- uses: gardener/cc-utils/.github/actions/export-ocm-fragments@v1
4646
with:
4747
ocm-resources: |
4848
name: odg-extension-definitions
@@ -55,7 +55,7 @@ jobs:
5555

5656
helmcharts:
5757
name: Build Helmcharts
58-
uses: gardener/cc-utils/.github/workflows/helmchart-ocm.yaml@master
58+
uses: gardener/cc-utils/.github/workflows/helmchart-ocm.yaml@v1
5959
needs:
6060
- prepare
6161
permissions:

.github/workflows/non-release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: CI (non-release)
22
on:
3+
pull_request_target:
34
push:
45
workflow_dispatch:
56

@@ -14,7 +15,7 @@ jobs:
1415
mode: snapshot
1516

1617
component-descriptor:
17-
uses: gardener/cc-utils/.github/workflows/post-build.yaml@master
18+
uses: gardener/cc-utils/.github/workflows/post-build.yaml@v1
1819
needs:
1920
- build
2021
permissions:

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
mode: release
2020

2121
release-to-github-and-bump:
22-
uses: gardener/cc-utils/.github/workflows/release.yaml@master
22+
uses: gardener/cc-utils/.github/workflows/release.yaml@v1
2323
needs:
2424
- build
2525
permissions:

0 commit comments

Comments
 (0)