From 74933bb3eb4b14c9462d36938b6e09b19326b909 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:11:11 +0000 Subject: [PATCH 01/23] chore: add documentation reminder issue tracker --- .../missing-documentation-reminder.yml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/missing-documentation-reminder.yml diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml new file mode 100644 index 0000000000..e76c7a02dc --- /dev/null +++ b/.github/workflows/missing-documentation-reminder.yml @@ -0,0 +1,40 @@ +name: Missing Documentation Reminder + +on: + schedule: + - cron: '0 0 * * *' # Runs nightly at midnight + workflow_dispatch: + +jobs: + find-missing-documentation: + permissions: + contents: read + issues: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Find closed PRs with 'needs documentation' label + uses: actions/github-script@v6 + id: find-prs + with: + script: | + const { data: pullRequests } = await github.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed', + labels: 'needs documentation' + }); + + const prsNeedingDocs = pullRequests.filter(pr => pr.labels.some(label => label.name === 'needs documentation')); + + return prsNeedingDocs.map(pr => `- ${pr.html_url} by @${pr.user.login}`).join("\n"); + + - name: Update Issue Body + uses: julien-deramond/update-issue-body@v1 + with: + issue-number: 255 + body: | + The following PRs have been closed but still need updates in the book: + ${{ steps.find-prs.outputs.result }} + edit-mode: replace \ No newline at end of file From 44f218300a36151a905f1e58233643fd570bdf34 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:14:17 +0000 Subject: [PATCH 02/23] make it run on pr events --- .github/workflows/missing-documentation-reminder.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index e76c7a02dc..8080ad7009 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -1,9 +1,11 @@ name: Missing Documentation Reminder on: - schedule: - - cron: '0 0 * * *' # Runs nightly at midnight workflow_dispatch: + pull_request: + types: + - edited + - closed jobs: find-missing-documentation: From 7d5703cfd9a9c225148a7533c5d338aef2b9ff73 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:15:15 +0000 Subject: [PATCH 03/23] add push event to test --- .github/workflows/missing-documentation-reminder.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 8080ad7009..1f1ec9c5b3 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -6,6 +6,9 @@ on: types: - edited - closed + push: + branches: + - "**" jobs: find-missing-documentation: From 33ddc23f0333c2504aecda6b9c6593b7e79cb570 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:22:41 +0000 Subject: [PATCH 04/23] use paginated search instead --- .../missing-documentation-reminder.yml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 1f1ec9c5b3..7f4c729f91 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -24,17 +24,19 @@ jobs: id: find-prs with: script: | - const { data: pullRequests } = await github.pulls.list({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'closed', - labels: 'needs documentation' + const query = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:closed label:"needs documentation"`; + const { data: { items: pullRequests } } = await github.rest.search.issuesAndPullRequests({ + q: query, + per_page: 100 }); - const prsNeedingDocs = pullRequests.filter(pr => pr.labels.some(label => label.name === 'needs documentation')); - - return prsNeedingDocs.map(pr => `- ${pr.html_url} by @${pr.user.login}`).join("\n"); - + const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} by @${pr.user.login}`).join("\n"); + if (!prsNeedingDocs) { + return "- [x] All PRs with 'needs documentation' label have been updated in the book."; + } else { + return prsNeedingDocs; + } + - name: Update Issue Body uses: julien-deramond/update-issue-body@v1 with: From 9b89368a18b543ba4d5ec85551b0b3af64923422 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:25:31 +0000 Subject: [PATCH 05/23] strip strings --- .github/workflows/missing-documentation-reminder.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 7f4c729f91..aca045147d 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -36,6 +36,7 @@ jobs: } else { return prsNeedingDocs; } + result-encoding: string - name: Update Issue Body uses: julien-deramond/update-issue-body@v1 From 7616e76407721dd253c3799971f123b689f53dab Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:27:37 +0000 Subject: [PATCH 06/23] only use merged PR's --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index aca045147d..47cf9da690 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -24,7 +24,7 @@ jobs: id: find-prs with: script: | - const query = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:closed label:"needs documentation"`; + const query = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:closed label:"needs documentation" is:merged`; const { data: { items: pullRequests } } = await github.rest.search.issuesAndPullRequests({ q: query, per_page: 100 From e60448c0357254c3e10cda852d41c5428ee39537 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:31:26 +0000 Subject: [PATCH 07/23] format query --- .github/workflows/missing-documentation-reminder.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 47cf9da690..ea5a6281a8 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -26,7 +26,7 @@ jobs: script: | const query = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:closed label:"needs documentation" is:merged`; const { data: { items: pullRequests } } = await github.rest.search.issuesAndPullRequests({ - q: query, + q: `q=${encodeURIComponent(query)}`, per_page: 100 }); @@ -45,4 +45,7 @@ jobs: body: | The following PRs have been closed but still need updates in the book: ${{ steps.find-prs.outputs.result }} + + If you are an author of one of these PRs, please consider updating the boook in `/docs` with appropriate documentation. + Thank you! edit-mode: replace \ No newline at end of file From be29b11db415a3f9ca253e9b0d048d8cda94deb3 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:33:56 +0000 Subject: [PATCH 08/23] add logging and remove q= --- .github/workflows/missing-documentation-reminder.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index ea5a6281a8..f0563f0977 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,11 +25,17 @@ jobs: with: script: | const query = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:closed label:"needs documentation" is:merged`; + const encodedQuery = encodeURIComponent(query); + + console.log(encodedQuery); + const { data: { items: pullRequests } } = await github.rest.search.issuesAndPullRequests({ - q: `q=${encodeURIComponent(query)}`, + q: encodedQuery, per_page: 100 }); + console.log(items) + const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} by @${pr.user.login}`).join("\n"); if (!prsNeedingDocs) { return "- [x] All PRs with 'needs documentation' label have been updated in the book."; From c819130cd301b3ea519be0f797f477c867dca375 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:34:56 +0000 Subject: [PATCH 09/23] log better --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index f0563f0977..46c2f616b9 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -34,7 +34,7 @@ jobs: per_page: 100 }); - console.log(items) + console.log(pullRequests) const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} by @${pr.user.login}`).join("\n"); if (!prsNeedingDocs) { From a276e358d7d300ad431701b1d552ca648aa44065 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:37:36 +0000 Subject: [PATCH 10/23] add pull request read permissions --- .github/workflows/missing-documentation-reminder.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 46c2f616b9..308703ff18 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -14,6 +14,7 @@ jobs: find-missing-documentation: permissions: contents: read + pull-requests: read issues: write runs-on: ubuntu-latest steps: From 4d7086242f0d27eaddf50c0b1f30283a9c3a2838 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:39:20 +0000 Subject: [PATCH 11/23] test simpler query --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 308703ff18..3bc617c9f4 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,7 +25,7 @@ jobs: id: find-prs with: script: | - const query = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:closed label:"needs documentation" is:merged`; + const query = `repo:${context.repo.owner}/${context.repo.repo} author:makspll`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From 798c868b8aef790ec7f7b28add54b456cc3a2f9a Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:41:40 +0000 Subject: [PATCH 12/23] try even simpler query --- .github/workflows/missing-documentation-reminder.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 3bc617c9f4..732c5b3cb7 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,7 +25,7 @@ jobs: id: find-prs with: script: | - const query = `repo:${context.repo.owner}/${context.repo.repo} author:makspll`; + const query = `repo:${context.repo.owner}/${context.repo.repo}`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); @@ -37,7 +37,7 @@ jobs: console.log(pullRequests) - const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} by @${pr.user.login}`).join("\n"); + const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} `).join("\n"); if (!prsNeedingDocs) { return "- [x] All PRs with 'needs documentation' label have been updated in the book."; } else { From 274448c79028218930387bbb99051c88837165b2 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:42:39 +0000 Subject: [PATCH 13/23] even simpler --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 732c5b3cb7..fe9d431ae1 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,7 +25,7 @@ jobs: id: find-prs with: script: | - const query = `repo:${context.repo.owner}/${context.repo.repo}`; + const query = ``; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From c8068802922680dc24862d4b0586dc9da9560472 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:44:22 +0000 Subject: [PATCH 14/23] try something else --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index fe9d431ae1..1520d1532e 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,7 +25,7 @@ jobs: id: find-prs with: script: | - const query = ``; + const query = `bevy`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From e3c496140593ef42f707521902221b381d1e7529 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:46:27 +0000 Subject: [PATCH 15/23] scope by repo --- .github/workflows/missing-documentation-reminder.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 1520d1532e..d4edcc7355 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,7 +25,10 @@ jobs: id: find-prs with: script: | - const query = `bevy`; + const repo = context.repo; + const repo_scope = `${repo.owner}/${repo.repo}`; + + const query = `${repo_scope} bevy`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From d39c433a0af0af90c1b96ccb04e4ab05a24944c4 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:50:14 +0000 Subject: [PATCH 16/23] repo scope properly --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index d4edcc7355..0b31dd6cc6 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -28,7 +28,7 @@ jobs: const repo = context.repo; const repo_scope = `${repo.owner}/${repo.repo}`; - const query = `${repo_scope} bevy`; + const query = `repo:${repo_scope} bevy`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From e68c419d1837ba288f24b6caea05ba99bb65e004 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:50:42 +0000 Subject: [PATCH 17/23] remove potenial for accidental linkage --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 0b31dd6cc6..b12229dbee 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -35,7 +35,7 @@ jobs: const { data: { items: pullRequests } } = await github.rest.search.issuesAndPullRequests({ q: encodedQuery, - per_page: 100 + per_page: 1 }); console.log(pullRequests) From 92b84bbeb7046f838e392216aa41dd382cf00d98 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:55:14 +0000 Subject: [PATCH 18/23] dont encode query --- .github/workflows/missing-documentation-reminder.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index b12229dbee..60ea7e18ce 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -25,16 +25,14 @@ jobs: id: find-prs with: script: | - const repo = context.repo; - const repo_scope = `${repo.owner}/${repo.repo}`; - const query = `repo:${repo_scope} bevy`; + const query = `repo:${{ github.repository }} bevy`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); const { data: { items: pullRequests } } = await github.rest.search.issuesAndPullRequests({ - q: encodedQuery, + q: query, per_page: 1 }); From 263db3cf3c4fb948e172b1a4d3c8f355bbcd7270 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:56:37 +0000 Subject: [PATCH 19/23] add fulll repo string --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 60ea7e18ce..398fa4fb6c 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -26,7 +26,7 @@ jobs: with: script: | - const query = `repo:${{ github.repository }} bevy`; + const query = `repo:makspll/bevy_mod_scripting bevy`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From 71c0f3279dae31378f0b140e8628c81c46312528 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:57:31 +0000 Subject: [PATCH 20/23] actually find what I want --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 398fa4fb6c..4a63d6a6da 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -26,7 +26,7 @@ jobs: with: script: | - const query = `repo:makspll/bevy_mod_scripting bevy`; + const query = `repo:makspll/bevy_mod_scripting is:pr is:merged is:closed label:"needs documentation"`; const encodedQuery = encodeURIComponent(query); console.log(encodedQuery); From 8b004b50f871ac93e04b9bcc01eed62559db3d3e Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 16:59:08 +0000 Subject: [PATCH 21/23] don't run on push events --- .github/workflows/missing-documentation-reminder.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 4a63d6a6da..989f10201f 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -6,9 +6,6 @@ on: types: - edited - closed - push: - branches: - - "**" jobs: find-missing-documentation: From b3fab59165af899b72d7a8f3c752d8e4f6b5a6d3 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 17:00:34 +0000 Subject: [PATCH 22/23] tag user --- .github/workflows/missing-documentation-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 989f10201f..9d9cc114e7 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -35,7 +35,7 @@ jobs: console.log(pullRequests) - const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} `).join("\n"); + const prsNeedingDocs = pullRequests.map(pr => `- [ ] ${pr.html_url} by @${pr.user.login}`).join("\n"); if (!prsNeedingDocs) { return "- [x] All PRs with 'needs documentation' label have been updated in the book."; } else { From 00d8f416ee0790d3c453d166a16dc5ed0a21f14b Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 8 Feb 2025 17:01:29 +0000 Subject: [PATCH 23/23] add notice of auto-generation --- .github/workflows/missing-documentation-reminder.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/missing-documentation-reminder.yml b/.github/workflows/missing-documentation-reminder.yml index 9d9cc114e7..3cb25e7c25 100644 --- a/.github/workflows/missing-documentation-reminder.yml +++ b/.github/workflows/missing-documentation-reminder.yml @@ -48,6 +48,8 @@ jobs: with: issue-number: 255 body: | + This is an automatically generated issue. + The following PRs have been closed but still need updates in the book: ${{ steps.find-prs.outputs.result }}