diff --git a/.github/pr-comment-reminder.md b/.github/pr-comment-reminder.md new file mode 100644 index 000000000000..e2a19ebab427 --- /dev/null +++ b/.github/pr-comment-reminder.md @@ -0,0 +1,7 @@ +### Pull Request reminders for autofix + +(internal access required) + +- [ ] Autofixes generated based on these changes are valid, only needed if this PR makes significant changes to `.ql`, `.qll`, or `.qhelp` files. See [the documentation](https://github.com/github/codeql-team/blob/main/docs/best-practices/validating-autofix-for-query-changes.md). +- [ ] Changes to autofix are validated [at scale](https://github.com/github/codeql-dca/blob/main/doc/autofix.md). +- [ ] Adding a new query? Consider also [adding the query to autofix](https://github.com/github/codeml-autofix/blob/main/docs/updating-query-support.md#adding-a-new-query-to-the-query-suite). diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 3b31894b0f37..000000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,14 +0,0 @@ -### Pull Request checklist - -#### All query authors - -- [ ] A change note is added if necessary. See [the documentation](https://github.com/github/codeql/blob/main/docs/change-notes.md) in this repository. -- [ ] All new queries have appropriate `.qhelp`. See [the documentation](https://github.com/github/codeql/blob/main/docs/query-help-style-guide.md) in this repository. -- [ ] QL tests are added if necessary. See [Testing custom queries](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/testing-custom-queries) in the GitHub documentation. -- [ ] New and changed queries have correct query metadata. See [the documentation](https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md) in this repository. - -#### Internal query authors only - -- [ ] Autofixes generated based on these changes are valid, only needed if this PR makes significant changes to `.ql`, `.qll`, or `.qhelp` files. See [the documentation](https://github.com/github/codeql-team/blob/main/docs/best-practices/validating-autofix-for-query-changes.md) (internal access required). -- [ ] Changes are validated [at scale](https://github.com/github/codeql-dca/) (internal access required). -- [ ] Adding a new query? Consider also [adding the query to autofix](https://github.com/github/codeml-autofix/blob/main/docs/updating-query-support.md#adding-a-new-query-to-the-query-suite). diff --git a/.github/workflows/check-change-note.yml b/.github/workflows/check-change-note-and-reminders.yml similarity index 71% rename from .github/workflows/check-change-note.yml rename to .github/workflows/check-change-note-and-reminders.yml index 3330e6e1136d..6d139098b810 100644 --- a/.github/workflows/check-change-note.yml +++ b/.github/workflows/check-change-note-and-reminders.yml @@ -1,4 +1,4 @@ -name: Check change note +name: Check change note and reminders permissions: pull-requests: read @@ -9,17 +9,39 @@ on: paths: - "*/ql/src/**/*.ql" - "*/ql/src/**/*.qll" + - "*/ql/src/**/*.qhelp" - "*/ql/lib/**/*.ql" - "*/ql/lib/**/*.qll" + - "*/ql/lib/**/*.qhelp" - "*/ql/lib/**/*.yml" - "shared/**/*.ql" - "shared/**/*.qll" + - "shared/**/*.qhelp" - "!**/experimental/**" - "!ql/**" - "!rust/**" - ".github/workflows/check-change-note.yml" jobs: + add-pr-reminders: + env: + REPO: ${{ github.repository }} + PULL_REQUEST_NUMBER: ${{ github.event.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-latest + steps: + + - name: Check if the 'reminders' comment exists + run: | + reminder_comment=$(gh api "repos/$REPO/issues/$PULL_REQUEST_NUMBER/comments" --jq '.[] | select(.body | test("### Pull Request reminders for autofix"))') + + if [ -z "$reminder_comment" ]; then + echo "The reminder comment does not exist. Adding it." + comment_body="$(cat .github/pr-comment-reminder.md)" + + gh api "repos/$REPO/issues/$PULL_REQUEST_NUMBER/comments" -f body="$comment_body" + fi + check-change-note: env: REPO: ${{ github.repository }}