Skip to content

Commit

Permalink
Enhance changelog verifier script
Browse files Browse the repository at this point in the history
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
  • Loading branch information
kotwanikunal committed Apr 4, 2024
1 parent 1869680 commit 4a4351a
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions .github/workflows/changelog_verifier.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,65 @@
name: "Changelog Verifier"
on:
pull_request:
types: [opened, edited, review_requested, synchronize, reopened, ready_for_review, labeled, unlabeled]
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
# Enforces the update of a changelog file on every pull request
verify-changelog:
if: github.repository == 'opensearch-project/OpenSearch'
verify-changelog-3x:
# if: github.repository == 'opensearch-project/OpenSearch'
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.publisher.outputs.valid }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
- uses: dangoslen/changelog-enforcer@v3
id: verify-changelog
with:
skipLabels: "autocut, skip-changelog"
changeLogPath: 'CHANGELOG-3.0.md'
continue-on-error: true
- id: publisher
run: |
if [[ ${{ steps.verify-changelog.outcome }} == 'failure'; then
echo "valid=false" >> "$GITHUB_OUTPUT"
else
echo "valid=true" >> "$GITHUB_OUTPUT"
fi
verify-changelog-2x:
# if: github.repository == 'opensearch-project/OpenSearch' && needs.verify-changelog-3x.result == 'failure'
if: always()
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.publisher.outputs.valid }}
needs: [ verify-changelog-3x ]
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}

- uses: dangoslen/changelog-enforcer@v3
id: verify-changelog
with:
skipLabels: "autocut, skip-changelog"
changeLogPath: 'CHANGELOG-2.0.md'
continue-on-error: true
- id: publisher
run: |
if [[ ${{ steps.verify-changelog.outcome }} == 'failure'; then
echo "valid=false" >> "$GITHUB_OUTPUT"
else
echo "valid=true" >> "$GITHUB_OUTPUT"
fi
overall-status:
# if: github.repository == 'opensearch-project/OpenSearch'
runs-on: ubuntu-latest
needs: [ verify-changelog-3x, verify-changelog-2x ]
steps:
- name: Check job statuses
run: |
if [[ ${{ needs.verify-changelog-3x.outputs.valid }} == 'false' && ${{ needs.verify-changelog-2x.outputs.valid }} == 'false' ]]; then
exit 1
fi

0 comments on commit 4a4351a

Please sign in to comment.