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.

To check linked GitHub issues in PullApprove, you can use the pull.linked_issues variable in PR restriction or as part of a review workflow.

Code review check that requires linked GitHub issues

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.

Linked issue syntax in GitHub pull request body

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.

Linked issues dropdown in GitHub