diff --git a/.github/workflows/changelog_verifier.yml b/.github/workflows/changelog_verifier.yml index 9456fbf8b4ca0..bf241bdb3e239 100644 --- a/.github/workflows/changelog_verifier.yml +++ b/.github/workflows/changelog_verifier.yml @@ -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