Skip to content

Fix CI check for code changed (suggested by Zach) #1410

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
merged 3 commits into from
May 2, 2025
Merged
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
14 changes: 9 additions & 5 deletions .github/workflows/build-and-run-node-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ jobs:
run_tests: ${{ steps.filter.outputs.changes_detected }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for relevant changes
id: filter
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E "^(node/|crates/|pallets/|runtime/)"; then
echo "changes_detected=true" >> $GITHUB_ENV
## If this is the first commit on a branch, then the default behaviour of github.event.before is to show the previous ref as
## repeated zeroes, as the previous ref is null
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
elif git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E "^(node/|crates/|pallets/|runtime/)"; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
else
echo "changes_detected=false" >> $GITHUB_ENV
echo "changes_detected=false" >> $GITHUB_OUTPUT
fi
- name: Set output
run: echo "changes_detected=${{ env.changes_detected }}" >> $GITHUB_OUTPUT

node-test:
needs: code-paths-changed
Expand Down