Skip to content

Commit 4cb6c80

Browse files
committed
Updated backport-verification to a full set of PR verification with more mandatory sections
1 parent f7fdd05 commit 4cb6c80

File tree

2 files changed

+57
-32
lines changed

2 files changed

+57
-32
lines changed

.github/workflows/backport-verification.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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, synchronize, reopened]
12+
branches:
13+
- develop
14+
- develop-2.0.0
15+
16+
jobs:
17+
pr-verification:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Check PR description
24+
uses: actions/github-script@v7
25+
with:
26+
script: |
27+
const pr = context.payload.pull_request;
28+
const body = pr.body || '';
29+
30+
// List of mandatory PR sections
31+
const requiredSections = [
32+
{
33+
header: '## Backport',
34+
description: '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.'
35+
},
36+
{
37+
header: '## Testing & QA',
38+
description: 'PR description must include a "## Testing & QA" section. Please add this section and provide information about the testing performed for this PR. It can range from adding unit tests to full samples and is needed from QA side to analyze PRs while Playtesting for the release.'
39+
},
40+
{
41+
header: '### Documentation',
42+
description: 'PR description must include a "### Documentation" section. Please add this section and provide information about the documentation changes made in this PR. It's important to keep the documentation up to date with the code changes.'
43+
}
44+
];
45+
46+
const missing = requiredSections.filter(section => !body.includes(section));
47+
48+
if (missing.length > 0) {
49+
const message = [
50+
'PR description is missing the following required section(s):',
51+
...missing.map(
52+
s => `- ${s.header}: ${s.description}`
53+
),
54+
'\nPlease add them to your PR description.'
55+
].join('\n');
56+
core.setFailed(message);
57+
}

0 commit comments

Comments
 (0)