mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 08:21:07 -06:00
Pull Request Template validation (#326)
Co-authored-by: Elbaz <eranelbaz97@gmail.com>
This commit is contained in:
parent
992b5d604a
commit
886895c649
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@ -10,12 +10,12 @@ https://github.com/opentffoundation/opentf/blob/main/CONTRIBUTING.md
|
||||
|
||||
<!--
|
||||
|
||||
Link all GitHub issues fixed by this PR, and add references to prior
|
||||
related PRs.
|
||||
Link all GitHub issues fixed by this PR, and add references to prior related PRs.
|
||||
Make sure to first open issue, get community approval and then create Pull Request to resolve it
|
||||
|
||||
-->
|
||||
|
||||
Fixes #
|
||||
Resolves #
|
||||
|
||||
## Target Release
|
||||
|
||||
|
35
.github/workflows/pr-lint.yml
vendored
Normal file
35
.github/workflows/pr-lint.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Pull Request Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: ['opened', 'edited', 'reopened', 'synchronize']
|
||||
|
||||
jobs:
|
||||
check-linked-issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check for linked issues
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
QUERY='query ($prNumber: Int!, $repositoryName: String!, $repositoryOwner: String!) {
|
||||
repository(name: $repositoryName, owner: $repositoryOwner) {
|
||||
pullRequest(number: $prNumber) {
|
||||
closingIssuesReferences(first: 10) {
|
||||
nodes {
|
||||
number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
ISSUES=$(gh api graphql -f query="$QUERY" -F prNumber=${{ github.event.pull_request.number }} -F repositoryName=${{ github.event.repository.name }} -F repositoryOwner=${{ github.event.repository.owner.login }} -q '.data.repository.pullRequest.closingIssuesReferences.nodes[] | .number')
|
||||
|
||||
if [ -z "$ISSUES" ]
|
||||
then
|
||||
echo "No issues linked to this PR. Please link an issue and try again."
|
||||
exit 1
|
||||
else
|
||||
echo "Issue(s) linked: $ISSUES"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user