Skip to content

Commit

Permalink
Only keep modified and added files
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Jan 26, 2023
1 parent a9e929e commit 52f7462
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint_changed_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
page=1
files=""
while true; do
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | .filename')
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | select(.status == "modified" or .status == "added") | .filename')
if [ -z "$new_files" ]; then
break
fi
Expand All @@ -95,7 +95,7 @@ jobs:
done
else
# Get changed files by comparing the current commit to the commit before the push event:
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
fi
files=$(echo "$files" | tr '\n' ' ' | sed 's/ $//')
echo "files=${files}" >> $GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_affected_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
page=1
files=""
while true; do
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | .filename')
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | select(.status == "modified" or .status == "added") | .filename')
if [ -z "$new_files" ]; then
break
fi
Expand All @@ -100,7 +100,7 @@ jobs:
done
else
# Get changed files by comparing the current commit to the commit before the push event:
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
fi
# Keep only benchmark files:
files=$(echo "$files" | grep -E 'benchmark/' | tr '\n' ' ' | sed 's/ $//')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_affected_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
page=1
files=""
while true; do
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | .filename')
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | select(.status == "modified" or .status == "added") | .filename')
if [ -z "$new_files" ]; then
break
fi
Expand All @@ -102,7 +102,7 @@ jobs:
done
else
# Get changed files by comparing the current commit to the commit before the push event:
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
fi
# Keep only examples and `README.md` files:
files=$(echo "$files" | grep -E 'examples/|README.md' | tr '\n' ' ' | sed 's/ $//')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_affected_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
page=1
files=""
while true; do
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | .filename')
new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | select(.status == "modified" or .status == "added") | .filename')
if [ -z "$new_files" ]; then
break
fi
Expand All @@ -136,7 +136,7 @@ jobs:
done
else
# Get changed files by comparing the current commit to the commit before the push event:
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
fi
directories=$(for file in $files; do dirname $file; done | uniq | tr '\n' ' ' | sed 's/ $//')
echo "directories=${directories}" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scaffold_pkg_via_branch_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: 'Get list of changed files'
id: changed-files
run: |
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
files=$(echo "$files" | tr '\n' ' ' | sed 's/ $//')
echo "files=${files}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 52f7462

Please sign in to comment.