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

chore: move commit check into the same job... #176

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/next-container-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
# don't fail if nothing returned by grep
set +e
CHANGES="$(git diff --name-only HEAD~1 | \
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
grep -v -E ".+_test.go|/.rhdh/")";
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
grep -v -E ".+_test.go|/.rhdh/")";
echo "Changed files for this commit:"
echo "=============================="
echo "$CHANGES"
Expand Down
35 changes: 12 additions & 23 deletions .github/workflows/pr-container-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,31 @@ jobs:
run: |
echo "✓"
check-changes:
# check if the change for this PR necessitates a rebuild of containers
pr-build:
name: PR Publish
runs-on: ubuntu-latest
needs: authorize
permissions:
contents: read
packages: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: check-changes
# check changes in this commit for regex include and exclude matches; pipe to an env var

# check changes in this commit for regex include and exclude matches; pipe to an env var
- name: Check for changes to build
run: |
# don't fail if nothing returned by grep
set +e
CHANGES="$(git diff --name-only HEAD~1 | \
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
grep -v -E ".+_test.go|/.rhdh/")";
grep -E "workflows/.+-container-build.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go|docker/|\.dockerignore" | \
grep -v -E ".+_test.go|/.rhdh/")";
echo "Changed files for this commit:"
echo "=============================="
echo "$CHANGES"
Expand All @@ -77,23 +83,6 @@ jobs:
echo EOF
} >> "$GITHUB_ENV"
pr-build:
name: PR Publish
runs-on: ubuntu-latest
needs: [authorize, check-changes]
permissions:
contents: read
packages: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup Go
# run this stage only if there are changes that match the includes and not the excludes
if: ${{ env.CHANGES != '' }}
Expand Down
26 changes: 7 additions & 19 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,23 @@ on:
- 1.[0-9]+.x

jobs:
check-changes:
# check if the change for this PR necessitates a rebuild of containers
pr-validate:
name: PR Validate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: check-changes
# check changes in this commit for regex include and exclude matches; pipe to an env var
# note regexes are different for the PR check than for *-container-build.yaml

# check changes in this commit for regex include and exclude matches; pipe to an env var
- name: Check for changes to build
run: |
# don't fail if nothing returned by grep
set +e
CHANGES="$(git diff --name-only HEAD~1 | \
grep -E "workflows/pr.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go" | \
grep -v -E "/.rhdh/")";
grep -E "workflows/pr.yaml|Makefile|bundle/|config/|go.mod|go.sum|.+\.go" | \
grep -v -E "/.rhdh/")";
echo "Changed files for this commit:"
echo "=============================="
echo "$CHANGES"
Expand All @@ -51,16 +49,6 @@ jobs:
echo EOF
} >> "$GITHUB_ENV"
pr-validate:
name: PR Validate
runs-on: ubuntu-latest
needs: check-changes
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
Expand Down
Loading