Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal authored Jul 14, 2023
1 parent 594edd5 commit f0e199c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Test changed files
with:
Expand Down
6 changes: 5 additions & 1 deletion changed-files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ runs:
elif [ "${{ github.event_name }}" == "pull_request" ]; then
pr_number=$(echo ${{ github.event.pull_request.number }})
fi
if [ -n "$pr_number" ]; then
base_ref=$(gh pr view $pr_number --json baseRefName -q '.baseRefName')
head_ref=$(gh pr view $pr_number --json headRefName -q '.headRefName')
git fetch origin $base_ref $head_ref
git branch -a
last_merged_commit=$(git merge-base origin/$base_ref origin/$head_ref)
changed_paths=$(git diff --name-only $last_merged_commit..origin/$head_ref)
else
elif [ $(git rev-list --count HEAD) -gt 1 ]; then
changed_paths=$(git diff --name-only HEAD~1)
else
echo "No previous commit to compare with."
fi
changed_paths=$(echo $changed_paths | tr '\n' ' ')
echo "CHANGED_PATHS=$changed_paths" >> $GITHUB_ENV
echo "Changed paths: ${PATHS[@]}"
Expand Down

0 comments on commit f0e199c

Please sign in to comment.