Skip to content

Commit f3ec307

Browse files
ci: backport-verification test (#3385)
Due to nature of NGO of having 2 development branches (`develop` for NGOv1.X and `develop-2.0.0` for NGOv2.X) we need to ensure that relevant changes are landing in only one branch (when it's relevant to only develop-2.0.0 for example) or both of them. For people not familiar with NGO structure (but also for us) it might be easy to omit the fact of making a backport (or forward port) so this PR includes a GitHub workflow that will check if "**## Backport**" section exist in the PR thus making it mandatory. This will add a bit of work to each PR but it will ensure that developers get reminded about backports and hopefully this will lead to - Easier PR tracking since every PR will contain a description of a backport or reasoning why a backport is not needed - Reduction of potential forgotten backports which in turn could increase overall quality of NGO I tested this workflow on my fork of NGO repo and seems to be working as expected ## Backport Backport created in #3393. After this PR gets approved I will modify branch protection rules to block PRs from merging if this check fails. --------- Co-authored-by: Emma <[email protected]>
1 parent 9329b80 commit f3ec307

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

.github/pull_request_template.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

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

5-
<!-- Add RFC link here if applicable. -->
6-
75
## Changelog
86

97
- Added: The package whose Changelog should be added to should be in the header. Delete the changelog section entirely if it's not needed.
@@ -26,3 +24,13 @@
2624
- [ ] Deprecation of the API is explained in the CHANGELOG.
2725
- [ ] The users can understand why this API was removed and what they should use instead.
2826
-->
27+
28+
## Backport
29+
30+
<!-- If this is a backport:
31+
- Add the following to the PR title: "\[Backport\] ..." .
32+
- Link to the original PR.
33+
If this needs a backport - state this here
34+
If a backport is not needed please provide the reason why.
35+
If the "Backports" section is not present it will lead to a CI test failure.
36+
-->
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 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.
2+
# 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
3+
# If the "##Backport" section is missing, the workflow will fail and block the PR from merging, prompting the developer to add this section.
4+
5+
# The workflow is configured to run when PR is created as well as when it is edited which also counts simple description edits.
6+
7+
name: "NGO - Backport Verification"
8+
9+
on:
10+
pull_request:
11+
types: [opened, edited]
12+
branches:
13+
- develop
14+
- develop-2.0.0
15+
16+
jobs:
17+
backport-verification:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Check PR description
24+
uses: actions/github-script@v6
25+
with:
26+
script: |
27+
const pr = context.payload.pull_request;
28+
const body = pr.body || '';
29+
30+
if (!body.includes('## Backport')) {
31+
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.');
32+
}

0 commit comments

Comments
 (0)