From d8a975c349d4ee76ffc2dcde5806543282ba5140 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Mon, 25 Nov 2024 12:50:26 -0800 Subject: [PATCH] Remove pull request template Replace with an updated check-change-note.yml workflow. Add a comment whenever a pull request has changes that may need to be tested in autofix. Also, remove parts of the checklist that are not related to autofix. --- .github/pull_request_template.md | 14 ------------ .github/workflows/check-change-note.yml | 30 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 15 deletions(-) delete mode 100644 .github/pull_request_template.md 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.yml index 3330e6e1136d..22ceed7c600d 100644 --- a/.github/workflows/check-change-note.yml +++ b/.github/workflows/check-change-note.yml @@ -1,4 +1,4 @@ -name: Check change note +name: Check change note and reminders permissions: pull-requests: read @@ -9,17 +9,45 @@ 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: | + checklist_comment=$(gh api "repos/$REPO/issues/$PULL_REQUEST_NUMBER/comments" --jq '.[] | select(.body | test("### Pull Request checklist"))') + + if [ -z "$checklist_comment" ]; then + echo "The checklist comment does not exist. Adding it." + comment_body="$(cat <