fix: Enhance CI workflow to improve skip logic and compatibility
Some checks failed
CI / skip-ci-check (pull_request) Failing after 8m25s
CI / lint-and-type-check (pull_request) Has been skipped
CI / test (pull_request) Has been skipped
CI / build (pull_request) Has been skipped
CI / secret-scanning (pull_request) Has been skipped
CI / dependency-scan (pull_request) Has been skipped
CI / sast-scan (pull_request) Has been skipped
CI / workflow-summary (pull_request) Successful in 1m18s
Some checks failed
CI / skip-ci-check (pull_request) Failing after 8m25s
CI / lint-and-type-check (pull_request) Has been skipped
CI / test (pull_request) Has been skipped
CI / build (pull_request) Has been skipped
CI / secret-scanning (pull_request) Has been skipped
CI / dependency-scan (pull_request) Has been skipped
CI / sast-scan (pull_request) Has been skipped
CI / workflow-summary (pull_request) Successful in 1m18s
- Default to not skipping CI unless specified - Set outputs in both modern and legacy formats for broader runner compatibility - Refactor skip condition checks for consistency across jobs
This commit is contained in:
parent
c16b38522c
commit
44cd5f5e0b
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
@ -21,6 +21,9 @@ jobs:
|
|||||||
- name: Check if CI should be skipped
|
- name: Check if CI should be skipped
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
|
# Default to not skipping
|
||||||
|
SKIP=0
|
||||||
|
|
||||||
# Simple skip pattern: @skipci (case-insensitive)
|
# Simple skip pattern: @skipci (case-insensitive)
|
||||||
SKIP_PATTERN="@skipci"
|
SKIP_PATTERN="@skipci"
|
||||||
|
|
||||||
@ -36,8 +39,6 @@ jobs:
|
|||||||
COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null || echo "")
|
COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null || echo "")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SKIP=0
|
|
||||||
|
|
||||||
# Check branch name (case-insensitive)
|
# Check branch name (case-insensitive)
|
||||||
if echo "$BRANCH_NAME" | grep -qiF "$SKIP_PATTERN"; then
|
if echo "$BRANCH_NAME" | grep -qiF "$SKIP_PATTERN"; then
|
||||||
echo "Skipping CI: branch name contains '$SKIP_PATTERN'"
|
echo "Skipping CI: branch name contains '$SKIP_PATTERN'"
|
||||||
@ -52,7 +53,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "skip=$SKIP" >> $GITHUB_OUTPUT
|
# Set outputs in both modern and legacy formats for wider runner compatibility
|
||||||
|
echo "skip=$SKIP" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "::set-output name=skip::$SKIP"
|
||||||
echo "Branch: $BRANCH_NAME"
|
echo "Branch: $BRANCH_NAME"
|
||||||
echo "Commit: ${COMMIT_MSG:0:50}..."
|
echo "Commit: ${COMMIT_MSG:0:50}..."
|
||||||
echo "Skip CI: $SKIP"
|
echo "Skip CI: $SKIP"
|
||||||
@ -60,7 +63,7 @@ jobs:
|
|||||||
lint-and-type-check:
|
lint-and-type-check:
|
||||||
needs: skip-ci-check
|
needs: skip-ci-check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.skip-ci-check.outputs.should-skip != '1'
|
if: &should_run ${{ needs.skip-ci-check.outputs.should-skip != '1' }}
|
||||||
container:
|
container:
|
||||||
image: node:20-bullseye
|
image: node:20-bullseye
|
||||||
steps:
|
steps:
|
||||||
@ -79,7 +82,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
needs: skip-ci-check
|
needs: skip-ci-check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.skip-ci-check.outputs.should-skip != '1'
|
if: *should_run
|
||||||
container:
|
container:
|
||||||
image: node:20-bullseye
|
image: node:20-bullseye
|
||||||
services:
|
services:
|
||||||
@ -127,7 +130,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
needs: skip-ci-check
|
needs: skip-ci-check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.skip-ci-check.outputs.should-skip != '1'
|
if: *should_run
|
||||||
container:
|
container:
|
||||||
image: node:20-bullseye
|
image: node:20-bullseye
|
||||||
steps:
|
steps:
|
||||||
@ -152,7 +155,7 @@ jobs:
|
|||||||
|
|
||||||
secret-scanning:
|
secret-scanning:
|
||||||
needs: skip-ci-check
|
needs: skip-ci-check
|
||||||
if: needs.skip-ci-check.outputs.should-skip != '1'
|
if: *should_run
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: zricethezav/gitleaks:latest
|
image: zricethezav/gitleaks:latest
|
||||||
@ -172,7 +175,7 @@ jobs:
|
|||||||
|
|
||||||
dependency-scan:
|
dependency-scan:
|
||||||
needs: skip-ci-check
|
needs: skip-ci-check
|
||||||
if: needs.skip-ci-check.outputs.should-skip != '1'
|
if: *should_run
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: aquasec/trivy:latest
|
image: aquasec/trivy:latest
|
||||||
@ -206,7 +209,7 @@ jobs:
|
|||||||
|
|
||||||
sast-scan:
|
sast-scan:
|
||||||
needs: skip-ci-check
|
needs: skip-ci-check
|
||||||
if: needs.skip-ci-check.outputs.should-skip != '1'
|
if: *should_run
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ubuntu:22.04
|
image: ubuntu:22.04
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user