Skip to content

Commit

Permalink
Draft script to comment on missing CHANGELOG entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Strech committed Dec 3, 2024
1 parent 5f7db8b commit 478d12f
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ensure-changelog-entry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Check change log entry
on:
pull_request:
types: [opened, reopened, edited]

jobs:
ensure_changelog_entry:
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
steps:
- name: Find entry
uses: actions/github-script@v7
id: found
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// Groups: yes - 1, entry - 2, no - 3
const regex = /\*\*CHANGELOG entry\*\*\s+(?:(yes|yeah)(?:\.\s*(.*))?|(no|nope|none)\.?)\s*(?:\*\*Additional Notes|\*\*How to test|\z)/mi
return context.payload.pull_request.body.match()
- name: Notify on missing entry
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// Is author a part of the Datadog/ruby-guild
if (false) {
// Leave comment for Datadog/ruby-guild
// and then exit
// return
}
console.log(found)
# If main response is missing
if (undefined == found.at(1) || undefined == found.at(3)) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
`Please fill CHANGELOG entry section.
If your changes need mention in a CHANGELOG
> Yes. <brief summary to be placed into the change log>
or as follows if they don't
> No.
`,
})
}

0 comments on commit 478d12f

Please sign in to comment.