Skip to content

Commit

Permalink
diff with upstream branch if no previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaldon authored Aug 8, 2024
1 parent 29572b0 commit 98471f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tex-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
- name: Get changed files
run: |
# check to see if there's a previous commit on the branch
# if not, then diff with the common ancestor of HEAD and origin/main
# if not, then diff with the upstream branch
# if yes, then diff with the HEAD @ prevous commit
if [[ -z "${{ github.event.before_ref }}" ]] ; then
export MERGE_BASE_SHA=$(git merge-base origin/main ${{ github.sha }})
export DIFF=$( git diff --name-only $MERGE_BASE_SHA ${{ github.sha }} )
echo "Diff between $MERGE_BASE_SHA and ${{ github.sha }} "
export UPSTREAM_BRANCH=$(git rev-parse --abbrev-ref --symbolic-full-name @{u})
export DIFF=$( git diff --name-only $UPSTREAM_BRANCH ${{ github.sha }} )
echo "Diff between $UPSTREAM_BRANCH and ${{ github.sha }} "
else
export DIFF=$( git diff --name-only ${{ github.event.before }} ${{ github.sha }} )
echo "Diff between ${{ github.event.before }} and ${{ github.sha }} "
Expand Down

0 comments on commit 98471f4

Please sign in to comment.