Skip to content

Commit 0d1da3d

Browse files
committed
chore(ci): run required checks on develop pushes
1 parent 3827a13 commit 0d1da3d

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
branches: [ main, develop ]
66
push:
7-
branches: [ main ]
7+
branches: [ main, develop ]
88
workflow_dispatch:
99

1010
# Cancel previous runs for the same PR/branch
@@ -73,7 +73,7 @@ jobs:
7373
name: Install Dependencies
7474
runs-on: ubuntu-latest
7575
needs: changes
76-
if: needs.changes.outputs.source == 'true' || needs.changes.outputs.config == 'true' || needs.changes.outputs.tests == 'true'
76+
if: needs.changes.outputs.source == 'true' || needs.changes.outputs.config == 'true' || needs.changes.outputs.tests == 'true' || needs.changes.outputs.styles == 'true'
7777
permissions:
7878
contents: read
7979
steps:
@@ -114,6 +114,8 @@ jobs:
114114
steps:
115115
- name: Checkout repository
116116
uses: actions/checkout@v4
117+
with:
118+
fetch-depth: 0
117119

118120
- name: Setup pnpm
119121
uses: pnpm/action-setup@v4
@@ -132,14 +134,22 @@ jobs:
132134

133135
- name: Run ESLint on changed files
134136
run: |
135-
# Get list of changed JS/TS files in this PR
136-
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep -E '\.(js|jsx|ts|tsx)$' | tr '\n' ' ' || true)
137+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
138+
RANGE="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
139+
elif [[ "${{ github.event.before }}" != "" && "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
140+
RANGE="${{ github.event.before }}..${{ github.sha }}"
141+
else
142+
RANGE="$(git hash-object -t tree /dev/null)..${{ github.sha }}"
143+
fi
144+
145+
echo "Using diff range: $RANGE"
146+
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT "$RANGE" | grep -E '\.(js|jsx|ts|tsx)$' | tr '\n' ' ' || true)
137147
138148
if [ -n "$CHANGED_FILES" ]; then
139149
echo "Running ESLint on changed files: $CHANGED_FILES"
140150
pnpm exec eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache $CHANGED_FILES
141151
else
142-
echo "No JS/TS files changed in this PR"
152+
echo "No JS/TS files changed in this event"
143153
fi
144154
145155
# TypeScript type checking
@@ -308,9 +318,17 @@ jobs:
308318
fi
309319
310320
# Check if any required job was skipped when it shouldn't be
321+
if [[ "${{ needs.changes.outputs.source }}" == "true" ]] || \
322+
[[ "${{ needs.changes.outputs.config }}" == "true" ]] || \
323+
[[ "${{ needs.changes.outputs.styles }}" == "true" ]]; then
324+
if [[ "${{ needs.format-and-lint.result }}" == "skipped" ]]; then
325+
echo "❌ Format and lint job was skipped"
326+
exit 1
327+
fi
328+
fi
329+
311330
if [[ "${{ needs.changes.outputs.source }}" == "true" ]] || [[ "${{ needs.changes.outputs.config }}" == "true" ]]; then
312-
if [[ "${{ needs.format-and-lint.result }}" == "skipped" ]] || \
313-
[[ "${{ needs.type-check.result }}" == "skipped" ]] || \
331+
if [[ "${{ needs.type-check.result }}" == "skipped" ]] || \
314332
[[ "${{ needs.build.result }}" == "skipped" ]] || \
315333
[[ "${{ needs.security-check.result }}" == "skipped" ]]; then
316334
echo "❌ Required job was skipped"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ pm2-logs/
6666
.playwright-cli/
6767
output/
6868
local-scripts/
69+
local_scripts/
6970
local-docs/
7071
local_docs/
7172

0 commit comments

Comments
 (0)