Skip to content

ci: backport-verification test #3385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

<!-- Add short version of the JIRA ticket to the PR title (e.g. "feat: new shiny feature [MTT-123]") -->

<!-- Add RFC link here if applicable. -->

## Changelog

- Added: The package whose Changelog should be added to should be in the header. Delete the changelog section entirely if it's not needed.
Expand All @@ -26,3 +24,13 @@
- [ ] Deprecation of the API is explained in the CHANGELOG.
- [ ] The users can understand why this API was removed and what they should use instead.
-->

## Backport

<!-- If this is a backport:
- Add the following to the PR title: "\[Backport\] ..." .
- Link to the original PR.
If this needs a backport - state this here
If a backport is not needed please provide the reason why.
If the "Backports" section is not present it will lead to a CI test failure.
-->
32 changes: 32 additions & 0 deletions .github/workflows/backport-verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow is designed to verify that the pull request description contains a "## Backport" section, which is important as a reminder to account for backports for anyone that works with NGO repository.
# We have 2 development branches (develop and develop-2.0.0) and we need to ensure that relevant changes are landing in only one or both of them
# If the "##Backport" section is missing, the workflow will fail and block the PR from merging, prompting the developer to add this section.

# The workflow is configured to run when PR is created as well as when it is edited which also counts simple description edits.

name: "NGO - Backport Verification"

on:
pull_request:
types: [opened, edited]
branches:
- develop
- develop-2.0.0

jobs:
backport-verification:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Check PR description
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const body = pr.body || '';

if (!body.includes('## Backport')) {
core.setFailed('PR description must include a "## Backport" section. Please add this section and provide information about this PR backport to develop or develop-2.0.0 branch respectively or explain why backport is not needed.');
}