Skip to content

chore: PR template and validation updates #1

chore: PR template and validation updates

chore: PR template and validation updates #1

Workflow file for this run

# 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, synchronize, reopened]
branches:
- develop
- develop-2.0.0
jobs:
pr-verification:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check PR description
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const body = pr.body || '';
// List of mandatory PR sections
const requiredSections = [
{
header: '## Backport',
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.'
},
{
header: '## Testing & QA',
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.'
},
{
header: '### Documentation',
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.'
}
];
const missing = requiredSections.filter(section => !body.includes(section));
if (missing.length > 0) {
const message = [
'PR description is missing the following required section(s):',
...missing.map(
s => `- ${s.header}: ${s.description}`
),
'\nPlease add them to your PR description.'
].join('\n');
core.setFailed(message);
}