Skip to content

Commit 5dac56a

Browse files
committed
PR sections verification
1 parent e67b963 commit 5dac56a

File tree

2 files changed

+61
-32
lines changed

2 files changed

+61
-32
lines changed

.github/workflows/backport-verification.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This workflow is designed to verify that the pull request description contains a required sections that are important from quality perspective.
2+
# ## Backport section is important as a reminder to account for backports for anyone that works with NGO repository (to 1.X or 2.X branches respectively).
3+
# ## Testing & QA section is important to ensure that the PR has appropriate testing coverage and is important when QA will evaluate PRs before Playtesting for the release.
4+
# ### Documentation section is important to ensure that the documentation is updated with the changes made in the PR.
5+
6+
# If any of the sections is missing, the workflow will fail and block the PR from merging, prompting the developer to add those sections to the PR description.
7+
# The workflow is configured to run when PR is created as well as when it is edited which also counts simple description edits.
8+
9+
name: "NGO - PR Verification"
10+
11+
on:
12+
pull_request:
13+
types: [opened, edited, synchronize, reopened]
14+
branches:
15+
- develop
16+
- develop-2.0.0
17+
18+
jobs:
19+
pr-verification:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Check PR description
26+
uses: actions/github-script@v7
27+
with:
28+
script: |
29+
const pr = context.payload.pull_request;
30+
const body = pr.body || '';
31+
32+
// List of mandatory PR sections
33+
const requiredSections = [
34+
{
35+
header: '## Backport',
36+
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.'
37+
},
38+
{
39+
header: '## Testing & QA',
40+
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.'
41+
},
42+
{
43+
header: '### Documentation',
44+
description: 'PR description must include a "### Documentation" section. Please add this section and provide information about the documentation changes made in this PR. It is important to keep the documentation up to date with the code changes.'
45+
}
46+
];
47+
48+
const missing = requiredSections.filter(section => !body.includes(section.header));
49+
50+
if (missing.length > 0) {
51+
let message = 'PR description is missing the following required section(s):\n';
52+
53+
const missingDescriptions = missing.map(
54+
s => `- ${s.header}: ${s.description}`
55+
);
56+
57+
message += missingDescriptions.join('\n');
58+
message += '\n\nPlease add them to your PR description.';
59+
60+
core.setFailed(message);
61+
}

0 commit comments

Comments
 (0)