Skip to content

Commit

Permalink
implement dynamic fetch depth
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1008 committed Apr 5, 2023
1 parent da06d61 commit d338282
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/check-components-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ jobs:
name: Check CHANGELOG diff
runs-on: ubuntu-latest
steps:
- name: 'Get PR commit count'
run: echo "PR_COMMIT_COUNT=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
- name: Checkout code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: ${{ env.PR_COMMIT_COUNT }}
- name: 'Fetch relevant history from origin'
run: git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Run git diff
run: |
changelog_path="packages/components/CHANGELOG.md"
if git diff --quiet ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- "$changelog_path"; then
if git diff --quiet ${{ github.event.pull_request.base.sha }} HEAD -- "$changelog_path"; then
echo "Please add a CHANGELOG entry to $changelog_path"
exit 1
fi

0 comments on commit d338282

Please sign in to comment.