-
Notifications
You must be signed in to change notification settings - Fork 567
CNTRLPLANE-3352: Add reusable GHA workflow definitions #8386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 1 commit into
openshift:main
from
bryan-cox:migrate-gh-jobs-reusable
Apr 30, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: Codespell (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| codespell: | ||
| name: Codespell | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - run: make verify-codespell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: CPO Container Sync (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| cpo-container-sync: | ||
| name: CPO Container Sync | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - run: make cpo-container-sync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Docs Build (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build Docs | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | ||
| with: | ||
| python-version: '3.x' | ||
| pip-install: '-r docs/requirements.txt' | ||
| env: | ||
| PIP_CACHE_DIR: ${{ runner.temp }}/.pip-cache | ||
| - name: Build documentation | ||
| run: mkdocs build --strict | ||
| working-directory: docs | ||
| - name: Save PR metadata | ||
| run: echo "${{ github.event.pull_request.number }}" > docs/site/pr-number.txt | ||
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: docs-site | ||
| path: docs/site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| name: Envtest Vanilla Kube API Validation (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
| push: | ||
| branches: | ||
| - main | ||
| - release-4.22 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| changes: | ||
| name: Detect Changes | ||
| runs-on: arc-runner-set | ||
| outputs: | ||
| should_run: ${{ steps.check.outputs.should_run }} | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Check for relevant file changes | ||
| id: check | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| CREATED: ${{ github.event.created }} | ||
| PR_DIFF_REF: origin/${{ github.base_ref }}...HEAD | ||
| PUSH_DIFF_REF: ${{ github.event.before }}..HEAD | ||
| run: | | ||
| if [ "$EVENT_NAME" = "workflow_dispatch" ] || [ "$CREATED" = "true" ]; then | ||
| echo "should_run=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| ref="$PUSH_DIFF_REF" | ||
| if [ "$EVENT_NAME" = "pull_request" ]; then | ||
| ref="$PR_DIFF_REF" | ||
| fi | ||
| if git diff --name-only "$ref" | grep -qE '^(api/|test/envtest/|cmd/install/assets/crds/hypershift-operator/tests/|karpenter-operator/controllers/karpenter/assets/tests/|\.github/workflows/envtest-kube(-reusable)?\.yaml$)'; then | ||
| echo "should_run=true" | ||
| else | ||
| echo "should_run=false" | ||
| fi >> "$GITHUB_OUTPUT" | ||
|
|
||
| envtest-kube: | ||
| name: Envtest Vanilla Kube ${{ matrix.version }} | ||
| needs: changes | ||
| if: needs.changes.outputs.should_run == 'true' | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 15 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: ["1.31.0", "1.32.0", "1.33.0", "1.34.0", "1.35.0"] | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - run: make test-envtest-kube ENVTEST_KUBE_VERSIONS="${{ matrix.version }}" | ||
|
|
||
| conclusion: | ||
| name: Conclusion | ||
| needs: | ||
| - changes | ||
| - envtest-kube | ||
| if: always() | ||
| runs-on: arc-runner-set | ||
| steps: | ||
| - name: Aggregate results | ||
| run: | | ||
| changes_result="${{ needs.changes.result }}" | ||
| envtest_result="${{ needs.envtest-kube.result }}" | ||
| if [ "$changes_result" != "success" ]; then | ||
| echo "Change detection failed: $changes_result" | ||
| exit 1 | ||
| fi | ||
| if [ "$envtest_result" = "success" ] || [ "$envtest_result" = "skipped" ]; then | ||
| echo "All envtest jobs passed or were skipped" | ||
| exit 0 | ||
| else | ||
| echo "Envtest jobs failed: $envtest_result" | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: Envtest OCP API Validation (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
| push: | ||
| branches: | ||
| - main | ||
| - release-4.22 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| changes: | ||
| name: Detect Changes | ||
| runs-on: arc-runner-set | ||
| outputs: | ||
| should_run: ${{ steps.check.outputs.should_run }} | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Check for relevant file changes | ||
| id: check | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| CREATED: ${{ github.event.created }} | ||
| PR_DIFF_REF: origin/${{ github.base_ref }}...HEAD | ||
| PUSH_DIFF_REF: ${{ github.event.before }}..HEAD | ||
| run: | | ||
| if [ "$EVENT_NAME" = "workflow_dispatch" ] || [ "$CREATED" = "true" ]; then | ||
| echo "should_run=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| ref="$PUSH_DIFF_REF" | ||
| if [ "$EVENT_NAME" = "pull_request" ]; then | ||
| ref="$PR_DIFF_REF" | ||
| fi | ||
| if git diff --name-only "$ref" | grep -qE '^(api/|test/envtest/|cmd/install/assets/crds/hypershift-operator/tests/|karpenter-operator/controllers/karpenter/assets/tests/|\.github/workflows/envtest-ocp(-reusable)?\.yaml$)'; then | ||
| echo "should_run=true" | ||
| else | ||
| echo "should_run=false" | ||
| fi >> "$GITHUB_OUTPUT" | ||
|
|
||
| envtest-ocp: | ||
| name: Envtest OCP (K8s ${{ matrix.version }}) | ||
| needs: changes | ||
| if: needs.changes.outputs.should_run == 'true' | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 15 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # OCP 4.17=1.30, 4.18=1.31, 4.19=1.32, 4.20=1.33, 4.21=1.34, 4.22=1.35 | ||
| version: ["1.30.3", "1.31.2", "1.32.1", "1.33.2", "1.34.1", "1.35.1"] | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - run: make test-envtest-ocp ENVTEST_OCP_K8S_VERSIONS="${{ matrix.version }}" | ||
|
|
||
| conclusion: | ||
| name: Conclusion | ||
| needs: | ||
| - changes | ||
| - envtest-ocp | ||
| if: always() | ||
| runs-on: arc-runner-set | ||
| steps: | ||
| - name: Aggregate results | ||
| run: | | ||
| changes_result="${{ needs.changes.result }}" | ||
| envtest_result="${{ needs.envtest-ocp.result }}" | ||
| if [ "$changes_result" != "success" ]; then | ||
| echo "Change detection failed: $changes_result" | ||
| exit 1 | ||
| fi | ||
| if [ "$envtest_result" = "success" ] || [ "$envtest_result" = "skipped" ]; then | ||
| echo "All envtest jobs passed or were skipped" | ||
| exit 0 | ||
| else | ||
| echo "Envtest jobs failed: $envtest_result" | ||
| exit 1 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: Gitlint (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| gitlint: | ||
| name: Gitlint | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - run: make run-gitlint | ||
| env: | ||
| PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| PULL_PULL_SHA: ${{ github.event.pull_request.head.sha }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Lint (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 60 | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - run: git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard base-ref fetch to avoid invalid refspec failures. Line 19 can fail when Proposed fix- - run: git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
+ - run: |
+ if [ -n "${{ github.base_ref }}" ]; then
+ git fetch origin "${{ github.base_ref }}:${{ github.base_ref }}"
+ fi🤖 Prompt for AI Agents |
||
| - name: Use pre-built lint tools | ||
| run: | | ||
| if [ -d /opt/lint-tools ]; then | ||
| mkdir -p hack/tools/bin | ||
| cp /opt/lint-tools/golangci-lint hack/tools/bin/ | ||
| cp /opt/lint-tools/kube-api-linter.so hack/tools/bin/ | ||
| touch hack/tools/bin/golangci-lint hack/tools/bin/kube-api-linter.so | ||
| fi | ||
| - run: make lint | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Unit Tests (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| CODECOV_TOKEN: | ||
| required: false | ||
| push: | ||
| branches: | ||
| - main | ||
| - release-4.22 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| changes: | ||
| name: Detect Changes | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 5 | ||
| outputs: | ||
| run_tests: ${{ steps.changes.outputs.run_tests }} | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | ||
| env: | ||
| HOME: /tmp | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: false | ||
| - name: Check for non-contrib changes | ||
| id: changes | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "run_tests=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| elif [ "${{ github.event_name }}" = "pull_request" ]; then | ||
| FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) | ||
| else | ||
| if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then | ||
| echo "run_tests=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| FILES=$(git diff --name-only ${{ github.event.before }}..${{ github.sha }}) | ||
| fi | ||
| if echo "$FILES" | grep -qvE '^(contrib|\.github|docs)/'; then | ||
| echo "run_tests=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "run_tests=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| test: | ||
| name: Unit Tests (${{ matrix.shard }}) | ||
| needs: changes | ||
| if: needs.changes.outputs.run_tests == 'true' | ||
| runs-on: arc-runner-set | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - shard: cpo-hostedcontrolplane | ||
| packages: ./control-plane-operator/controllers/hostedcontrolplane/... | ||
| - shard: cpo-other | ||
| packages: ./control-plane-operator/controllers/awsprivatelink/... ./control-plane-operator/controllers/azureprivatelinkservice/... ./control-plane-operator/controllers/gcpprivateserviceconnect/... ./control-plane-operator/controllers/healthcheck/... ./control-plane-operator/controllers/openshiftmanager/... ./control-plane-operator/endpoint-resolver/... ./control-plane-operator/hostedclusterconfigoperator/... ./control-plane-operator/metrics-proxy/... | ||
| - shard: hypershift-operator | ||
| packages: ./hypershift-operator/... | ||
| - shard: cmd-support | ||
| packages: ./cmd/... ./support/... | ||
| - shard: other | ||
| packages: ./karpenter-operator/... ./control-plane-pki-operator/... ./contrib/... ./ignition-server/... ./pkg/... ./dnsresolver/... ./product-cli/... ./client/... ./test/integration/... ./test/e2e/util/... ./test/util/... ./availability-prober/... ./konnectivity-socks5-proxy/... ./konnectivity-https-proxy/... ./kubernetes-default-proxy/... ./kubevirtexternalinfra/... ./etcd-defrag/... ./etcd-backup/... ./etcd-recovery/... ./etcd-upload/... ./kas-bootstrap/... ./sharedingress-config-generator/... ./sync-fg-configmap/... ./sync-global-pullsecret/... ./token-minter/... | ||
| env: | ||
| GOCACHE: /tmp/go-build-cache | ||
| GOMODCACHE: /tmp/go-mod-cache | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | ||
| env: | ||
| HOME: /tmp | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: false | ||
| - name: Restore Go build cache | ||
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | ||
| with: | ||
| path: /tmp/go-build-cache | ||
| key: go-build-${{ matrix.shard }}-${{ hashFiles('go.mod') }}-${{ github.sha }} | ||
| restore-keys: go-build-${{ matrix.shard }}-${{ hashFiles('go.mod') }}- | ||
| - name: Run tests | ||
| run: make test-shard TEST_PACKAGES="${{ matrix.packages }}" COVER_PROFILE="cover-${{ matrix.shard }}.out" | ||
| - name: Upload to Codecov | ||
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | ||
| env: | ||
| HOME: /tmp | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
| with: | ||
| files: cover-${{ matrix.shard }}.out | ||
| flags: ${{ matrix.shard }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
For a called reusable workflow, what are the documented behaviors ofgithub.event_name,github.eventpayload inheritance, andgithub.base_refavailability?💡 Result:
In a called reusable workflow (triggered by workflow_call): - github.event_name: Inherits the event name from the calling (top-level) workflow. It is NOT workflow_call; instead, it reflects the original trigger event of the caller (e.g., push, pull_request, workflow_dispatch). This is confirmed by GitHub Docs stating the github context is associated with the caller workflow, and practical evidence from GitHub issues where echo ${{ github.event_name }} in called workflows shows the caller's event. - github.event payload: Fully inherits the event payload from the calling workflow. Official GitHub Docs explicitly state: "When a workflow is triggered with the workflow_call event, the event payload in the called workflow is the same event payload from the calling workflow." Also, GITHUB_SHA and GITHUB_REF are the same as the caller. - github.base_ref availability: Available if the inherited github.event_name is pull_request or pull_request_target (from the caller). Per contexts docs, github.base_ref is set for those event types, containing the target branch of the PR. For other inherited events (e.g., push), it is empty/undefined.
Citations:
🏁 Script executed:
Repository: openshift/hypershift
Length of output: 817
🏁 Script executed:
cat -n .github/workflows/envtest-kube-reusable.yaml | head -80Repository: openshift/hypershift
Length of output: 3210
🏁 Script executed:
cat -n .github/workflows/envtest-ocp-reusable.yaml | head -80Repository: openshift/hypershift
Length of output: 3266
🏁 Script executed:
cat -n .github/workflows/envtest-ocp.yaml | head -40Repository: openshift/hypershift
Length of output: 1373
🏁 Script executed:
Repository: openshift/hypershift
Length of output: 136
🏁 Script executed:
Repository: openshift/hypershift
Length of output: 46
Apply ref-resolution fix for workflow_call context in this reusable workflow.
This workflow has the same event/ref handling issues that affect
workflow_callcontexts. When called as a reusable workflow withpush,pull_request, orworkflow_dispatchtriggers, the current code relies on context variables that may be undefined:github.base_refis only populated for pull_request events; it will be empty in other contextsgithub.event.createdis only set for workflow_dispatch eventsThis causes
git diffto fail or produce incorrect results, potentially skipping OCP envtest runs unintentionally.Use direct SHA references instead of event name/payload assumptions:
Suggested fix
- name: Check for relevant file changes id: check env: - EVENT_NAME: ${{ github.event_name }} - CREATED: ${{ github.event.created }} - PR_DIFF_REF: origin/${{ github.base_ref }}...HEAD - PUSH_DIFF_REF: ${{ github.event.before }}..HEAD + PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PUSH_BEFORE_SHA: ${{ github.event.before }} run: | - if [ "$EVENT_NAME" = "workflow_dispatch" ] || [ "$CREATED" = "true" ]; then - echo "should_run=true" >> "$GITHUB_OUTPUT" - exit 0 - fi - ref="$PUSH_DIFF_REF" - if [ "$EVENT_NAME" = "pull_request" ]; then - ref="$PR_DIFF_REF" - fi + set -euo pipefail + if [ -n "${PR_BASE_SHA:-}" ] && [ -n "${PR_HEAD_SHA:-}" ]; then + ref="${PR_BASE_SHA}...${PR_HEAD_SHA}" + elif [ -n "${PUSH_BEFORE_SHA:-}" ] && [ "$PUSH_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then + ref="${PUSH_BEFORE_SHA}..HEAD" + else + echo "should_run=true" >> "$GITHUB_OUTPUT" + exit 0 + fi if git diff --name-only "$ref" | grep -qE '^(api/|test/envtest/|cmd/install/assets/crds/hypershift-operator/tests/|karpenter-operator/controllers/karpenter/assets/tests/|\.github/workflows/envtest-ocp(-reusable)?\.yaml$)'; then echo "should_run=true" else echo "should_run=false" fi >> "$GITHUB_OUTPUT"📝 Committable suggestion
🤖 Prompt for AI Agents