Skip to content

Commit 9b123ad

Browse files
Merge pull request #1746 from cfengine/ENT-13038/3.24
Restrict workflow runs to cfengine organization pull requests (3.24)
2 parents 7d9b083 + 0621c06 commit 9b123ad

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/build-using-buildscripts.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ jobs:
3131
with:
3232
myToken: ${{ secrets.GITHUB_TOKEN }}
3333

34+
- name: Checkout Buildscripts
35+
uses: actions/checkout@v3
36+
with:
37+
repository: cfengine/buildscripts
38+
path: buildscripts
39+
fetch-depth: 20
40+
41+
- name: Get base ref
42+
# we use on:push in ../ci.yml when calling this workflow and that event does not include github.base_ref so we must calculate it here in case
43+
run: |
44+
git rev-parse --abbrev-ref @{upstream}
45+
3446
- name: Checkout Core
3547
uses: actions/checkout@v3
3648
with:
@@ -46,12 +58,6 @@ jobs:
4658
path: masterfiles
4759
ref: ${{steps.together.outputs.masterfiles || github.base_ref}}
4860

49-
- name: Checkout Buildscripts (current project)
50-
uses: actions/checkout@v3
51-
with:
52-
path: buildscripts
53-
fetch-depth: 20
54-
5561
- name: Checkout Nova
5662
uses: actions/checkout@v3
5763
with:

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Continuous Integration
22

3-
# Run this CI on all pushes to upstream
4-
# (including PRs from upstream to upstream)
5-
on: push
3+
on: pull_request
64

75
jobs:
86
build_cfengine_hub_package:
7+
# this job only works when submitted from the cfengine organization aka upstream to upstream pull requests: ENT-13038
8+
if: github.event.organization.login == 'cfengine'
99
uses: ./.github/workflows/build-using-buildscripts.yml
1010
secrets: inherit
1111

0 commit comments

Comments
 (0)