[chore][workflow/changelog] Fix comparisons to main (#2309)
This commit is contained in:
parent
4812769367
commit
28c92e2f78
|
|
@ -18,6 +18,8 @@ concurrency:
|
||||||
jobs:
|
jobs:
|
||||||
changelog:
|
changelog:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PR_HEAD: ${{ github.event.pull_request.head.sha }}
|
||||||
if: >-
|
if: >-
|
||||||
${{
|
${{
|
||||||
github.event_name == 'pull_request' &&
|
github.event_name == 'pull_request' &&
|
||||||
|
|
@ -45,7 +47,7 @@ jobs:
|
||||||
|
|
||||||
- name: Ensure no changes to the CHANGELOG.md
|
- name: Ensure no changes to the CHANGELOG.md
|
||||||
run: |
|
run: |
|
||||||
if [[ $(git diff --name-only origin/main HEAD ./CHANGELOG*.md) ]]
|
if [[ $(git diff --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD ./CHANGELOG*.md) ]]
|
||||||
then
|
then
|
||||||
echo "CHANGELOG.md should not be directly modified."
|
echo "CHANGELOG.md should not be directly modified."
|
||||||
echo "Please add a .yaml file to the ./.chloggen/ directory."
|
echo "Please add a .yaml file to the ./.chloggen/ directory."
|
||||||
|
|
@ -58,7 +60,7 @@ jobs:
|
||||||
|
|
||||||
- name: Ensure ./.chloggen/*.yaml addition(s)
|
- name: Ensure ./.chloggen/*.yaml addition(s)
|
||||||
run: |
|
run: |
|
||||||
if [[ 1 -gt $(git diff --diff-filter=A --name-only origin/main HEAD ./.chloggen | grep -c \\.yaml) ]]
|
if [[ 1 -gt $(git diff --diff-filter=A --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD ./.chloggen | grep -c \\.yaml) ]]
|
||||||
then
|
then
|
||||||
echo "No changelog entry was added to the ./.chloggen/ directory."
|
echo "No changelog entry was added to the ./.chloggen/ directory."
|
||||||
echo "Please add a .yaml file to the ./.chloggen/ directory."
|
echo "Please add a .yaml file to the ./.chloggen/ directory."
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue