diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..cb9846c5a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# https://docs.github.com/articles/about-code-owners +# Require review from the SDK team on every PR. + +* @Iterable/sdk-team diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b2cc4804e..e52b54eb0 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,22 @@ -## ๐Ÿ”น Jira Ticket(s) if any +# ๐Ÿ“ Summary +> _This should be a 150 characters summary of the changes on this PR_ -* [SDK-XXXX](https://iterable.atlassian.net/browse/SDK-XXXX) +###### ๐ŸŽŸ๏ธ Jira Ticket: [SDK-XXXX](https://iterable.atlassian.net/browse/SDK-XXXX) -## โœ๏ธ Description +## ๐Ÿ“– Description +> Please provide a description of what this pull request does. -> Please provide a brief description of what this pull request does. +## ๐Ÿงช How to test? +> How to test the changes added? + +## ๐Ÿงพ Changelog +> Add an entry to `CHANGELOG.md`. If this PR has no customer facing changes, write "No customer facing changes" here to skip the changelog check. + +## ๐Ÿ“น Loom recording if applicable +> If it helps the reviewer, add a short Loom going over the changes or showcasing the change in behavior. + +#### ๐Ÿž Github Issues solved +> If this solves any open GH Issues, please link them here. + +#### ๐Ÿ“š Docs PR if applicable +> Open a PR on the [Docs Repo](https://github.com/Iterable/iterable-docs) documenting the changes. diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml new file mode 100644 index 000000000..f98a59994 --- /dev/null +++ b/.github/workflows/changelog-check.yml @@ -0,0 +1,42 @@ +name: Changelog Check +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: + contents: read + pull-requests: read + +jobs: + changelog: + name: Verify CHANGELOG update + runs-on: ubuntu-latest + steps: + - name: Check CHANGELOG.md update or opt-out + uses: actions/github-script@v7 + with: + script: | + const optOut = 'No customer facing changes'; + const body = context.payload.pull_request.body || ''; + + if (body.toLowerCase().includes(optOut.toLowerCase())) { + core.info(`PR description contains "${optOut}", skipping CHANGELOG.md check.`); + return; + } + + const files = await github.paginate(github.rest.pulls.listFiles, { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + per_page: 100, + }); + + const changed = files.some((f) => f.filename === 'CHANGELOG.md'); + if (changed) { + core.info('CHANGELOG.md was updated.'); + return; + } + + core.setFailed( + 'CHANGELOG.md was not updated. Add a CHANGELOG.md entry, or if this PR has no customer facing changes, add "No customer facing changes" to the PR description to justify skipping the changelog.' + );