From 52f7462a26596e15fdc2db6ab22ec80cf8446fc3 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Wed, 25 Jan 2023 20:01:29 -0500 Subject: [PATCH] Only keep modified and added files --- .github/workflows/lint_changed_files.yml | 4 ++-- .github/workflows/run_affected_benchmarks.yml | 4 ++-- .github/workflows/run_affected_examples.yml | 4 ++-- .github/workflows/run_affected_tests.yml | 4 ++-- .github/workflows/scaffold_pkg_via_branch_push.yml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint_changed_files.yml b/.github/workflows/lint_changed_files.yml index dfd3e490444e..24eeb206a5cc 100644 --- a/.github/workflows/lint_changed_files.yml +++ b/.github/workflows/lint_changed_files.yml @@ -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 @@ -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 diff --git a/.github/workflows/run_affected_benchmarks.yml b/.github/workflows/run_affected_benchmarks.yml index 43df47fbae98..f81f214b5d5c 100644 --- a/.github/workflows/run_affected_benchmarks.yml +++ b/.github/workflows/run_affected_benchmarks.yml @@ -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 @@ -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/ $//') diff --git a/.github/workflows/run_affected_examples.yml b/.github/workflows/run_affected_examples.yml index 04845977dd9c..10d6b603a125 100644 --- a/.github/workflows/run_affected_examples.yml +++ b/.github/workflows/run_affected_examples.yml @@ -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 @@ -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/ $//') diff --git a/.github/workflows/run_affected_tests.yml b/.github/workflows/run_affected_tests.yml index f9063d84fa12..7c5dd4cb4731 100644 --- a/.github/workflows/run_affected_tests.yml +++ b/.github/workflows/run_affected_tests.yml @@ -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 @@ -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 diff --git a/.github/workflows/scaffold_pkg_via_branch_push.yml b/.github/workflows/scaffold_pkg_via_branch_push.yml index 56749f493173..67fca86f5e41 100644 --- a/.github/workflows/scaffold_pkg_via_branch_push.yml +++ b/.github/workflows/scaffold_pkg_via_branch_push.yml @@ -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