Verifying linked issues for traceability
GitHub pull requests can have a direct link to GitHub issues, and you can write PullApprove requirements to ensure that people use them. This is especially useful for establishing "traceability" for compliance reasons or otherwise.
Require at least one linked issue
len(pull.linked_issues) > 0
Require the PR author to be the author of the linked issues
Combine map and set to see if the pull request author is also the author of all the linked issues.
set(pull.linked_issues.map("x.user")) == set([pull.author])
How to link a GitHub issue to a GitHub pull request
There are multiple ways to do this in GitHub. Due to API limitations, we recommend that you use the "Closes #xxx" syntax in the pull request body for the best experience.
You can manually link issues to pull requests in the GitHub PR sidebar (or issue sidebar, or commit message), but there are no webhook events triggered by this so any checks you use (PullApprove, GitHub Actions, etc.) will not respond immediately to the change.