Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

Commit fc37ff4

Browse files
authored
chore: move commit check into the same job as the build as it seems env vars do not cross job boundaries; remove dep on other job (#176)
Signed-off-by: Nick Boldt <nboldt@redhat.com>
1 parent 9e716fa commit fc37ff4

File tree

3 files changed

+21
-44
lines changed

3 files changed

+21
-44
lines changed

.github/workflows/next-container-build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
# don't fail if nothing returned by grep
4949
set +e
5050
CHANGES="$(git diff --name-only HEAD~1 | \
51-
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
52-
grep -v -E ".+_test.go|/.rhdh/")";
51+
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
52+
grep -v -E ".+_test.go|/.rhdh/")";
5353
echo "Changed files for this commit:"
5454
echo "=============================="
5555
echo "$CHANGES"

.github/workflows/pr-container-build.yaml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,31 @@ jobs:
4848
run: |
4949
echo "✓"
5050
51-
check-changes:
52-
# check if the change for this PR necessitates a rebuild of containers
51+
pr-build:
52+
name: PR Publish
5353
runs-on: ubuntu-latest
5454
needs: authorize
55+
permissions:
56+
contents: read
57+
packages: write
58+
pull-requests: write
59+
5560
steps:
5661
- name: Checkout
5762
uses: actions/checkout@v4
5863
with:
5964
fetch-depth: 0
6065
ref: ${{ github.event.pull_request.head.ref }}
6166
repository: ${{ github.event.pull_request.head.repo.full_name }}
62-
- name: check-changes
63-
# check changes in this commit for regex include and exclude matches; pipe to an env var
67+
68+
# check changes in this commit for regex include and exclude matches; pipe to an env var
69+
- name: Check for changes to build
6470
run: |
6571
# don't fail if nothing returned by grep
6672
set +e
6773
CHANGES="$(git diff --name-only HEAD~1 | \
68-
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
69-
grep -v -E ".+_test.go|/.rhdh/")";
74+
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
75+
grep -v -E ".+_test.go|/.rhdh/")";
7076
echo "Changed files for this commit:"
7177
echo "=============================="
7278
echo "$CHANGES"
@@ -77,23 +83,6 @@ jobs:
7783
echo EOF
7884
} >> "$GITHUB_ENV"
7985
80-
pr-build:
81-
name: PR Publish
82-
runs-on: ubuntu-latest
83-
needs: [authorize, check-changes]
84-
permissions:
85-
contents: read
86-
packages: write
87-
pull-requests: write
88-
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@v4
92-
with:
93-
fetch-depth: 0
94-
ref: ${{ github.event.pull_request.head.ref }}
95-
repository: ${{ github.event.pull_request.head.repo.full_name }}
96-
9786
- name: Setup Go
9887
# run this stage only if there are changes that match the includes and not the excludes
9988
if: ${{ env.CHANGES != '' }}

.github/workflows/pr.yaml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,23 @@ on:
2222
- 1.[0-9]+.x
2323

2424
jobs:
25-
check-changes:
26-
# check if the change for this PR necessitates a rebuild of containers
25+
pr-validate:
26+
name: PR Validate
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout
3030
uses: actions/checkout@v4
3131
with:
3232
fetch-depth: 0
33-
ref: ${{ github.event.pull_request.head.ref }}
34-
repository: ${{ github.event.pull_request.head.repo.full_name }}
35-
- name: check-changes
36-
# check changes in this commit for regex include and exclude matches; pipe to an env var
37-
# note regexes are different for the PR check than for *-container-build.yaml
33+
34+
# check changes in this commit for regex include and exclude matches; pipe to an env var
35+
- name: Check for changes to build
3836
run: |
3937
# don't fail if nothing returned by grep
4038
set +e
4139
CHANGES="$(git diff --name-only HEAD~1 | \
42-
grep -E "workflows/pr.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go" | \
43-
grep -v -E "/.rhdh/")";
40+
grep -E "workflows/pr.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go" | \
41+
grep -v -E "/.rhdh/")";
4442
echo "Changed files for this commit:"
4543
echo "=============================="
4644
echo "$CHANGES"
@@ -51,16 +49,6 @@ jobs:
5149
echo EOF
5250
} >> "$GITHUB_ENV"
5351
54-
pr-validate:
55-
name: PR Validate
56-
runs-on: ubuntu-latest
57-
needs: check-changes
58-
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v4
61-
with:
62-
fetch-depth: 0
63-
6452
- name: Setup Go
6553
uses: actions/setup-go@v5
6654
with:

0 commit comments

Comments
 (0)