-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (32 loc) · 1.08 KB
/
javascript-on-pr.yml
File metadata and controls
37 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: 'JavaScript - On pull request'
on:
pull_request:
types: [ opened, reopened, synchronize ]
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if should run
id: check
run: |
# Always run for PRs targeting release branches
if [[ "${{ github.base_ref }}" == release/* ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
exit 0
fi
# Check if relevant files changed
CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -E '^(javascript/|\.github/workflows/javascript-)' || true)
if [ -n "$CHANGED" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi
build-and-test:
needs: check-changes
if: needs.check-changes.outputs.should_run == 'true'
uses: ./.github/workflows/javascript-build-and-test.yml