Skip to content

Commit

Permalink
Merge pull request #32 from codecov/pr32
Browse files Browse the repository at this point in the history
fix diff-dep: only look at requirements.in + get correct base for diff
  • Loading branch information
matt-codecov authored Sep 5, 2024
2 parents 2606974 + 7232c06 commit 1f2d4d1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/diff-dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ on:
dep:
type: string
required: true
reqs_file:
type: string
default: 'requirements.in'
jobs:
post-comment:
name: Post comment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 2

# Generate a GitHub link to a page that displays all commits/changes between
# the old dependency version and the new one, or an empty string if the dependency
# wasn't changed.
- name: Get compare URL
id: get-compare-url
run: |
compare_url=$(git diff -r ${{ github.event.pull_request.base.sha }} \
compare_url=$(git diff -r HEAD^ ${{ inputs.reqs_file }} \
| grep ${{ inputs.dep }}\/archive \
| cut -d '/' -f 7 \
| cut -d '.' -f 1 \
| awk 'NR%2{printf "https://github.com/codecov/${{ inputs.dep }}/compare/%s..",$0;next;}1')
| awk 'NR%2{printf "https://github.com/codecov/${{ inputs.dep }}/compare/%s...",$0;next;}1')
echo "Compare URL: $compare_url"
echo "COMPARE_URL=$compare_url" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -60,7 +63,7 @@ jobs:
run: |
if [ ! -f comment-id.txt ]; then
echo "Comment was newly created; getting ID out of response"
echo "${{ steps.create-comment.outputs.result }}" | jq '.data.id' > comment-id.txt
echo '${{ steps.create-comment.outputs.result }}' | jq '.data.id' > comment-id.txt
fi
echo "Comment ID is $(cat comment-id.txt)"
echo "COMMENT_ID=$(cat comment-id.txt)" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 1f2d4d1

Please sign in to comment.