Skip to content

Commit

Permalink
Make Check Changelog compatible with actions/checkout v2 (#135)
Browse files Browse the repository at this point in the history
The GitHub action `actions/checkout` now only shallow clones the Git
repo as of v2+, meaning the Check Changelog action fails with:
`fatal: ambiguous argument 'remotes/origin/main': unknown revision or path not in the working tree.`

To fix, an explicit `git fetch` has been added of the HEAD of the default branch.

In addition, the event types on which the check is run has been updated
to include missing event types:
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request

Refs GUS-W-9728468.
  • Loading branch information
edmorley authored Aug 9, 2021
1 parent 80195f7 commit 05293c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Check Changelog

on:
pull_request:
types: [opened, reopened, edited, synchronize, labeled]
types: [opened, reopened, edited, labeled, unlabeled, synchronize]

jobs:
check:
check-changelog:
runs-on: ubuntu-latest
if: |
!contains(github.event.pull_request.body, '[skip changelog]') &&
Expand All @@ -15,4 +15,6 @@ jobs:
steps:
- uses: actions/[email protected]
- name: Check that CHANGELOG is touched
run: git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
run: |
git fetch origin ${{ github.base_ref }} --depth 1 && \
git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md

0 comments on commit 05293c3

Please sign in to comment.