From 67d824cac9919771d89f59d1d3ec7b47abb12f89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 03:56:30 +0000 Subject: [PATCH 01/18] Bump mongoose from 8.3.1 to 8.3.2 Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.3.1 to 8.3.2. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md) - [Commits](https://github.com/Automattic/mongoose/compare/8.3.1...8.3.2) --- updated-dependencies: - dependency-name: mongoose dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5750674c2..fe4d6cb86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.3.1", + "mongoose": "^8.3.2", "nanoid": "3.3.4", "nconf": "^0.12.1", "react": "^18.2.0", @@ -10547,9 +10547,9 @@ } }, "node_modules/mongoose": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.3.1.tgz", - "integrity": "sha512-D78C+s7QI4+pJQhs3XbOxzrHFEti4x+BDhaH94QrdV1/cmMA7fHc50LgLSXjzA/5q89TBK8DAXyf3VwDZbQJlA==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.3.2.tgz", + "integrity": "sha512-3JcpDjFI25cF/3xpu+4+9nM0lURQTNLcP86X83+LvuICdn453QQLmhSrUr2IPM/ffLiDE9KPl9slNb2s0hZPpg==", "dependencies": { "bson": "^6.5.0", "kareem": "2.6.3", diff --git a/package.json b/package.json index 490e32601..783c1c82e 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "marked-smartypants-lite": "^1.0.2", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.3.1", + "mongoose": "^8.3.2", "nanoid": "3.3.4", "nconf": "^0.12.1", "react": "^18.2.0", From e1186b4a1ed5f8bc2f3bb199b9a83e4567f82737 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 17 Apr 2024 01:01:58 -0400 Subject: [PATCH 02/18] Rename Inline to SingleLine --- shared/naturalcrit/markdown.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 8018bf63b..c2c0710dd 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -294,8 +294,8 @@ const superSubScripts = { } }; -const definitionListsInline = { - name : 'definitionListsInline', +const definitionListsSingleLine = { + name : 'definitionListsSingleLine', level : 'block', start(src) { return src.match(/^[^\n]*?::[^\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { @@ -312,7 +312,7 @@ const definitionListsInline = { } if(definitions.length) { return { - type : 'definitionListsInline', + type : 'definitionListsSingleLine', raw : src.slice(0, endIndex), definitions }; @@ -326,8 +326,8 @@ const definitionListsInline = { } }; -const definitionListsMultiline = { - name : 'definitionListsMultiline', +const definitionListsMultiLine = { + name : 'definitionListsMultiLine', level : 'block', start(src) { return src.match(/^[^\n]*\n::/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { @@ -353,7 +353,7 @@ const definitionListsMultiline = { } if(definitions.length) { return { - type : 'definitionListsMultiline', + type : 'definitionListsMultiLine', raw : src.slice(0, endIndex), definitions }; @@ -617,7 +617,7 @@ function MarkedVariables() { //^=====--------------------< Variable Handling >-------------------=====^// Marked.use(MarkedVariables()); -Marked.use({ extensions: [definitionListsMultiline, definitionListsInline, superSubScripts, mustacheSpans, mustacheDivs, mustacheInjectInline] }); +Marked.use({ extensions: [definitionListsMultiLine, definitionListsSingleLine, superSubScripts, mustacheSpans, mustacheDivs, mustacheInjectInline] }); Marked.use(mustacheInjectBlock); Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false }); Marked.use(MarkedExtendedTables(), MarkedGFMHeadingId(), MarkedSmartypantsLite()); From 68a68bde829f33039c298cc63329d66db0899ece Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 17 Apr 2024 01:03:25 -0400 Subject: [PATCH 03/18] Only check for DLs at start of line Previous "start" regex used `^` instead of `\n`, which meant if the first character in a line failed to start a match, it would check for the start of a DL in *every* character in the line, which slows things down a lot. --- shared/naturalcrit/markdown.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index c2c0710dd..f72955bf3 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -297,7 +297,7 @@ const superSubScripts = { const definitionListsSingleLine = { name : 'definitionListsSingleLine', level : 'block', - start(src) { return src.match(/^[^\n]*?::[^\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match + start(src) { return src.match(/\n[^\n]*?::[^\n]*/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const regex = /^([^\n]*?)::([^\n]*)(?:\n|$)/ym; let match; @@ -329,7 +329,7 @@ const definitionListsSingleLine = { const definitionListsMultiLine = { name : 'definitionListsMultiLine', level : 'block', - start(src) { return src.match(/^[^\n]*\n::/m)?.index; }, // Hint to Marked.js to stop and check for a match + start(src) { return src.match(/\n[^\n]*\n::/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const regex = /(\n?\n?(?!::)[^\n]+?(?=\n::))|\n::(.(?:.|\n)*?(?=(?:\n::)|(?:\n\n)|$))/y; let match; From 709c9ece7459860a221d1d5b5922686c7ee12f32 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 18 Apr 2024 16:20:09 -0400 Subject: [PATCH 04/18] Change to camelCase --- themes/V3/5ePHB/style.less | 2 +- themes/V3/Blank/style.less | 2 +- themes/fonts/icon fonts/dicefont.less | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/V3/5ePHB/style.less b/themes/V3/5ePHB/style.less index 37327fb19..25b784cfc 100644 --- a/themes/V3/5ePHB/style.less +++ b/themes/V3/5ePHB/style.less @@ -1,6 +1,6 @@ @import (less) './themes/assets/assets.less'; @import (less) './themes/fonts/icon fonts/font-icons.less'; -@import (less) './themes/fonts/icon fonts/dicefont.less'; +@import (less) './themes/fonts/icon fonts/diceFont.less'; :root { //Colors diff --git a/themes/V3/Blank/style.less b/themes/V3/Blank/style.less index 1d8ca6ee4..ec8905630 100644 --- a/themes/V3/Blank/style.less +++ b/themes/V3/Blank/style.less @@ -1,6 +1,6 @@ @import (less) './themes/fonts/5e/fonts.less'; @import (less) './themes/assets/assets.less'; -@import (less) './themes/fonts/icon fonts/dicefont.less'; +@import (less) './themes/fonts/icon fonts/diceFont.less'; :root { //Colors diff --git a/themes/fonts/icon fonts/dicefont.less b/themes/fonts/icon fonts/dicefont.less index 78a88f03a..069f6f769 100644 --- a/themes/fonts/icon fonts/dicefont.less +++ b/themes/fonts/icon fonts/dicefont.less @@ -1,9 +1,9 @@ -/* Icon Font: dicefont */ +/* Icon Font: diceFont */ @font-face { font-family : 'DiceFont'; font-style : normal; font-weight : normal; - src : url('../../../fonts/icon fonts/dicefont.woff2'); + src : url('../../../fonts/icon fonts/diceFont.woff2'); } .df { From 1018ba554f20a872a97e4fdb9699e2bec6bd71b3 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 18 Apr 2024 16:42:06 -0400 Subject: [PATCH 05/18] rename files to camelCase --- .../icon fonts/{dicefont.less => diceFont.less} | 0 .../icon fonts/{dicefont.woff2 => diceFont.woff2} | Bin .../{dicefont_license.md => diceFont_license.md} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename themes/fonts/icon fonts/{dicefont.less => diceFont.less} (100%) rename themes/fonts/icon fonts/{dicefont.woff2 => diceFont.woff2} (100%) rename themes/fonts/icon fonts/{dicefont_license.md => diceFont_license.md} (100%) diff --git a/themes/fonts/icon fonts/dicefont.less b/themes/fonts/icon fonts/diceFont.less similarity index 100% rename from themes/fonts/icon fonts/dicefont.less rename to themes/fonts/icon fonts/diceFont.less diff --git a/themes/fonts/icon fonts/dicefont.woff2 b/themes/fonts/icon fonts/diceFont.woff2 similarity index 100% rename from themes/fonts/icon fonts/dicefont.woff2 rename to themes/fonts/icon fonts/diceFont.woff2 diff --git a/themes/fonts/icon fonts/dicefont_license.md b/themes/fonts/icon fonts/diceFont_license.md similarity index 100% rename from themes/fonts/icon fonts/dicefont_license.md rename to themes/fonts/icon fonts/diceFont_license.md From fc539899467509f5ae0a37c6fc430b28ac133c36 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 10:47:00 -0400 Subject: [PATCH 06/18] Create pr-check.yml For users with many open PRs, creates a warning message in the PR description when opening a new PR, encouraging users to complete existing PRs before opening new ones. --- .github/workflows/pr-check.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 000000000..951fd02c1 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,26 @@ +name: PR Check + +on: + pull_request: + types: + - opened + +jobs: + check-pr: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Get PR count + id: pr-count + run: | + PR_COUNT=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/naturalcrit/homebrewery/pulls? state=open&head=${{ github.actor }}:${{ github.head_ref }}" | jq '. | length') + echo "::set-output name=pr_count::$PR_COUNT" + + - name: Update PR description + if: ${{ steps.pr_count.outputs.pr_count }} -ge 1 + run: | + gh pr edit ${{ github.event.number }} --body "You already have ${{ steps.pr-count.outputs.pr_count }} PRs open. Consider completing some of your existing PRs before opening new ones." From 228041913ee02ef1af795d206e373bfdf7261b7d Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:15:27 -0400 Subject: [PATCH 07/18] Create limit-pull-requests.yml --- .github/workflows/limit-pull-requests.yml | 103 ++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/limit-pull-requests.yml diff --git a/.github/workflows/limit-pull-requests.yml b/.github/workflows/limit-pull-requests.yml new file mode 100644 index 000000000..413fa0624 --- /dev/null +++ b/.github/workflows/limit-pull-requests.yml @@ -0,0 +1,103 @@ +name: Limit pull requests +description: > + Limit the number of open pull requests to the repository created by a user +author: ZhongRuoyu (from Homebrew repository) +branding: + icon: alert-triangle + color: yellow + +inputs: + token: + description: GitHub token + required: false + default: ${{ github.token }} + except-users: + description: The users exempted from the limit, one per line + required: false + # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation + except-author-associations: + description: The author associations exempted from the limit, one per line + required: false + comment-limit: + description: > + Post the comment when the user's number of open pull requests exceeds this + number and `comment` is not empty + required: true + default: "10" + comment: + description: The comment to post when the limit is reached + required: false + close-limit: + description: > + Close the pull request when the user's number of open pull requests + exceeds this number and `close` is set to `true` + required: true + default: "50" + close: + description: Whether to close the pull request when the limit is reached + required: true + default: "false" + +runs: + using: composite + steps: + - name: Check the number of pull requests + id: count-pull-requests + run: | + # If the user is exempted, assume they have no pull requests. + if grep -Fiqx '${{ github.actor }}' <<<"$EXCEPT_USERS"; then + echo "::notice::@${{ github.actor }} is exempted from the limit." + echo "count=0" >>"$GITHUB_OUTPUT" + exit 0 + fi + if grep -Fiqx '${{ github.event.pull_request.author_association }}' <<<"$EXCEPT_AUTHOR_ASSOCIATIONS"; then + echo "::notice::@{{ github.actor }} is a ${{ github.event.pull_request.author_association }} exempted from the limit." + echo "count=0" >>"$GITHUB_OUTPUT" + exit 0 + fi + + count="$( + gh api \ + --method GET \ + --header 'Accept: application/vnd.github+json' \ + --header 'X-GitHub-Api-Version: 2022-11-28' \ + --field state=open \ + --paginate \ + '/repos/{owner}/{repo}/pulls' | + jq \ + --raw-output \ + --arg USER '${{ github.actor }}' \ + 'map(select(.user.login == $USER)) | length' + )" + echo "::notice::@${{ github.actor }} has $count open pull request(s)." + echo "count=$count" >>"$GITHUB_OUTPUT" + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ inputs.token }} + EXCEPT_USERS: ${{ inputs.except-users }} + EXCEPT_AUTHOR_ASSOCIATIONS: ${{ inputs.except-author-associations }} + shell: bash + + - name: Comment on pull request + if: > + fromJSON(steps.count-pull-requests.outputs.count) > fromJSON(inputs.comment-limit) && + inputs.comment != '' + run: | + gh pr comment '${{ github.event.pull_request.number }}' \ + --body="${COMMENT_BODY}" + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ inputs.token }} + COMMENT_BODY: ${{ inputs.comment }} + shell: bash + + - name: Close pull request + if: > + fromJSON(steps.count-pull-requests.outputs.count) > fromJSON(inputs.close-limit) && + inputs.close == 'true' + run: | + gh pr close '${{ github.event.pull_request.number }}' + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ inputs.token }} + shell: bash From f23959bb057df011aa3595f0e2579017cf7eac15 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:24:18 -0400 Subject: [PATCH 08/18] Update pr-check.yml --- .github/workflows/pr-check.yml | 43 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 951fd02c1..077eb0c4d 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -1,26 +1,25 @@ name: PR Check - -on: - pull_request: - types: - - opened - +on: pull_request_target +env: + GH_REPO: ${{ github.repository }} + GH_NO_UPDATE_NOTIFIER: 1 + GH_PROMPT_DISABLED: 1 +permissions: + contents: read + issues: write + pull-requests: write + statuses: write jobs: - check-pr: + limit-pull-requests: + if: always() && github.repository_owner == 'Homebrew' runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Get PR count - id: pr-count - run: | - PR_COUNT=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/naturalcrit/homebrewery/pulls? state=open&head=${{ github.actor }}:${{ github.head_ref }}" | jq '. | length') - echo "::set-output name=pr_count::$PR_COUNT" - - - name: Update PR description - if: ${{ steps.pr_count.outputs.pr_count }} -ge 1 - run: | - gh pr edit ${{ github.event.number }} --body "You already have ${{ steps.pr-count.outputs.pr_count }} PRs open. Consider completing some of your existing PRs before opening new ones." + - uses: Homebrew/actions/limit-pull-requests@master + with: + except-users: | + dependabot + comment-limit: 1 + comment: | + Hi, thanks for your contribution to the Homebrewery! You already have >=3 open pull requests. Consider completing some of your existing PRs before opening new ones. Thanks! + close-limit: 5 + close: false From 8b6be1cab8d2ae4fd775c68f69037d2448b6522d Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:33:55 -0400 Subject: [PATCH 09/18] Create limit-pull-requests.yml --- .../limit-pull-requests.yml | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/actions/limit-pull-requests/limit-pull-requests.yml diff --git a/.github/actions/limit-pull-requests/limit-pull-requests.yml b/.github/actions/limit-pull-requests/limit-pull-requests.yml new file mode 100644 index 000000000..413fa0624 --- /dev/null +++ b/.github/actions/limit-pull-requests/limit-pull-requests.yml @@ -0,0 +1,103 @@ +name: Limit pull requests +description: > + Limit the number of open pull requests to the repository created by a user +author: ZhongRuoyu (from Homebrew repository) +branding: + icon: alert-triangle + color: yellow + +inputs: + token: + description: GitHub token + required: false + default: ${{ github.token }} + except-users: + description: The users exempted from the limit, one per line + required: false + # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation + except-author-associations: + description: The author associations exempted from the limit, one per line + required: false + comment-limit: + description: > + Post the comment when the user's number of open pull requests exceeds this + number and `comment` is not empty + required: true + default: "10" + comment: + description: The comment to post when the limit is reached + required: false + close-limit: + description: > + Close the pull request when the user's number of open pull requests + exceeds this number and `close` is set to `true` + required: true + default: "50" + close: + description: Whether to close the pull request when the limit is reached + required: true + default: "false" + +runs: + using: composite + steps: + - name: Check the number of pull requests + id: count-pull-requests + run: | + # If the user is exempted, assume they have no pull requests. + if grep -Fiqx '${{ github.actor }}' <<<"$EXCEPT_USERS"; then + echo "::notice::@${{ github.actor }} is exempted from the limit." + echo "count=0" >>"$GITHUB_OUTPUT" + exit 0 + fi + if grep -Fiqx '${{ github.event.pull_request.author_association }}' <<<"$EXCEPT_AUTHOR_ASSOCIATIONS"; then + echo "::notice::@{{ github.actor }} is a ${{ github.event.pull_request.author_association }} exempted from the limit." + echo "count=0" >>"$GITHUB_OUTPUT" + exit 0 + fi + + count="$( + gh api \ + --method GET \ + --header 'Accept: application/vnd.github+json' \ + --header 'X-GitHub-Api-Version: 2022-11-28' \ + --field state=open \ + --paginate \ + '/repos/{owner}/{repo}/pulls' | + jq \ + --raw-output \ + --arg USER '${{ github.actor }}' \ + 'map(select(.user.login == $USER)) | length' + )" + echo "::notice::@${{ github.actor }} has $count open pull request(s)." + echo "count=$count" >>"$GITHUB_OUTPUT" + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ inputs.token }} + EXCEPT_USERS: ${{ inputs.except-users }} + EXCEPT_AUTHOR_ASSOCIATIONS: ${{ inputs.except-author-associations }} + shell: bash + + - name: Comment on pull request + if: > + fromJSON(steps.count-pull-requests.outputs.count) > fromJSON(inputs.comment-limit) && + inputs.comment != '' + run: | + gh pr comment '${{ github.event.pull_request.number }}' \ + --body="${COMMENT_BODY}" + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ inputs.token }} + COMMENT_BODY: ${{ inputs.comment }} + shell: bash + + - name: Close pull request + if: > + fromJSON(steps.count-pull-requests.outputs.count) > fromJSON(inputs.close-limit) && + inputs.close == 'true' + run: | + gh pr close '${{ github.event.pull_request.number }}' + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ inputs.token }} + shell: bash From 6e69696b4a6eaf94641ef44510da693cbecda9f9 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:34:06 -0400 Subject: [PATCH 10/18] Update pr-check.yml --- .github/workflows/pr-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 077eb0c4d..7784ce98e 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -14,7 +14,7 @@ jobs: if: always() && github.repository_owner == 'Homebrew' runs-on: ubuntu-latest steps: - - uses: Homebrew/actions/limit-pull-requests@master + - uses: ./.github/actions/limit-pull-requests with: except-users: | dependabot From 9f4545606610a65d09070ed63c110c4f341bfdb1 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:34:26 -0400 Subject: [PATCH 11/18] Delete .github/workflows/limit-pull-requests.yml --- .github/workflows/limit-pull-requests.yml | 103 ---------------------- 1 file changed, 103 deletions(-) delete mode 100644 .github/workflows/limit-pull-requests.yml diff --git a/.github/workflows/limit-pull-requests.yml b/.github/workflows/limit-pull-requests.yml deleted file mode 100644 index 413fa0624..000000000 --- a/.github/workflows/limit-pull-requests.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Limit pull requests -description: > - Limit the number of open pull requests to the repository created by a user -author: ZhongRuoyu (from Homebrew repository) -branding: - icon: alert-triangle - color: yellow - -inputs: - token: - description: GitHub token - required: false - default: ${{ github.token }} - except-users: - description: The users exempted from the limit, one per line - required: false - # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation - except-author-associations: - description: The author associations exempted from the limit, one per line - required: false - comment-limit: - description: > - Post the comment when the user's number of open pull requests exceeds this - number and `comment` is not empty - required: true - default: "10" - comment: - description: The comment to post when the limit is reached - required: false - close-limit: - description: > - Close the pull request when the user's number of open pull requests - exceeds this number and `close` is set to `true` - required: true - default: "50" - close: - description: Whether to close the pull request when the limit is reached - required: true - default: "false" - -runs: - using: composite - steps: - - name: Check the number of pull requests - id: count-pull-requests - run: | - # If the user is exempted, assume they have no pull requests. - if grep -Fiqx '${{ github.actor }}' <<<"$EXCEPT_USERS"; then - echo "::notice::@${{ github.actor }} is exempted from the limit." - echo "count=0" >>"$GITHUB_OUTPUT" - exit 0 - fi - if grep -Fiqx '${{ github.event.pull_request.author_association }}' <<<"$EXCEPT_AUTHOR_ASSOCIATIONS"; then - echo "::notice::@{{ github.actor }} is a ${{ github.event.pull_request.author_association }} exempted from the limit." - echo "count=0" >>"$GITHUB_OUTPUT" - exit 0 - fi - - count="$( - gh api \ - --method GET \ - --header 'Accept: application/vnd.github+json' \ - --header 'X-GitHub-Api-Version: 2022-11-28' \ - --field state=open \ - --paginate \ - '/repos/{owner}/{repo}/pulls' | - jq \ - --raw-output \ - --arg USER '${{ github.actor }}' \ - 'map(select(.user.login == $USER)) | length' - )" - echo "::notice::@${{ github.actor }} has $count open pull request(s)." - echo "count=$count" >>"$GITHUB_OUTPUT" - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ inputs.token }} - EXCEPT_USERS: ${{ inputs.except-users }} - EXCEPT_AUTHOR_ASSOCIATIONS: ${{ inputs.except-author-associations }} - shell: bash - - - name: Comment on pull request - if: > - fromJSON(steps.count-pull-requests.outputs.count) > fromJSON(inputs.comment-limit) && - inputs.comment != '' - run: | - gh pr comment '${{ github.event.pull_request.number }}' \ - --body="${COMMENT_BODY}" - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ inputs.token }} - COMMENT_BODY: ${{ inputs.comment }} - shell: bash - - - name: Close pull request - if: > - fromJSON(steps.count-pull-requests.outputs.count) > fromJSON(inputs.close-limit) && - inputs.close == 'true' - run: | - gh pr close '${{ github.event.pull_request.number }}' - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ inputs.token }} - shell: bash From 08e273bfd6183b8043b18e35989dac7a91c20743 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:37:23 -0400 Subject: [PATCH 12/18] Update pr-check.yml --- .github/workflows/pr-check.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 7784ce98e..7c986de7e 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -1,5 +1,8 @@ name: PR Check -on: pull_request_target +on: + pull_request: + types: + - opened env: GH_REPO: ${{ github.repository }} GH_NO_UPDATE_NOTIFIER: 1 From 19961c7ec55e7dcbea69fa82b2b6bb5db4418f9a Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:48:30 -0400 Subject: [PATCH 13/18] Update pr-check.yml --- .github/workflows/pr-check.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 7c986de7e..c2c3a5a04 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -1,8 +1,5 @@ name: PR Check -on: - pull_request: - types: - - opened +on: pull_request_target env: GH_REPO: ${{ github.repository }} GH_NO_UPDATE_NOTIFIER: 1 @@ -14,7 +11,7 @@ permissions: statuses: write jobs: limit-pull-requests: - if: always() && github.repository_owner == 'Homebrew' + if: always() && github.repository_owner == 'naturalcrit' runs-on: ubuntu-latest steps: - uses: ./.github/actions/limit-pull-requests From 1e5e3d5f4197f1409e1f068184e94802ba55f753 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:50:01 -0400 Subject: [PATCH 14/18] Rename limit-pull-requests.yml to action.yml --- .../limit-pull-requests/{limit-pull-requests.yml => action.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/limit-pull-requests/{limit-pull-requests.yml => action.yml} (100%) diff --git a/.github/actions/limit-pull-requests/limit-pull-requests.yml b/.github/actions/limit-pull-requests/action.yml similarity index 100% rename from .github/actions/limit-pull-requests/limit-pull-requests.yml rename to .github/actions/limit-pull-requests/action.yml From 80bcf92fa3e070a99778794b0b617c72de197a32 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 11:57:44 -0400 Subject: [PATCH 15/18] Update pr-check.yml --- .github/workflows/pr-check.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index c2c3a5a04..ac1eb3190 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -14,7 +14,11 @@ jobs: if: always() && github.repository_owner == 'naturalcrit' runs-on: ubuntu-latest steps: - - uses: ./.github/actions/limit-pull-requests + - name: Checkout + uses: actions/checkout@v2 + + - name : Run limit-pull-requests action + uses: ./.github/actions/limit-pull-requests with: except-users: | dependabot From 98d032913b0c236acabaf3a98ca2bea2fc087f76 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 19 Apr 2024 12:00:11 -0400 Subject: [PATCH 16/18] Update pr-check.yml --- .github/workflows/pr-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index ac1eb3190..e5adb2561 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -22,7 +22,7 @@ jobs: with: except-users: | dependabot - comment-limit: 1 + comment-limit: 3 comment: | Hi, thanks for your contribution to the Homebrewery! You already have >=3 open pull requests. Consider completing some of your existing PRs before opening new ones. Thanks! close-limit: 5 From 2197a9b7823430507ef5c05e972fa10eac2e250d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 03:27:56 +0000 Subject: [PATCH 17/18] Bump react-router-dom from 6.22.3 to 6.23.0 Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.22.3 to 6.23.0. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.23.0/packages/react-router-dom) --- updated-dependencies: - dependency-name: react-router-dom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 26 +++++++++++++------------- package.json | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5750674c2..0bbb50ea3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-frame-component": "^4.1.3", - "react-router-dom": "6.22.3", + "react-router-dom": "6.23.0", "sanitize-filename": "1.6.3", "superagent": "^8.1.2", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -2854,9 +2854,9 @@ } }, "node_modules/@remix-run/router": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.3.tgz", - "integrity": "sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.16.0.tgz", + "integrity": "sha512-Quz1KOffeEf/zwkCBM3kBtH4ZoZ+pT3xIXBG4PPW/XFtDP7EGhtTiC2+gpL9GnR7+Qdet5Oa6cYSvwKYg6kN9Q==", "engines": { "node": ">=14.0.0" } @@ -11976,11 +11976,11 @@ "dev": true }, "node_modules/react-router": { - "version": "6.22.3", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.3.tgz", - "integrity": "sha512-dr2eb3Mj5zK2YISHK++foM9w4eBnO23eKnZEDs7c880P6oKbrjz/Svg9+nxqtHQK+oMW4OtjZca0RqPglXxguQ==", + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.23.0.tgz", + "integrity": "sha512-wPMZ8S2TuPadH0sF5irFGjkNLIcRvOSaEe7v+JER8508dyJumm6XZB1u5kztlX0RVq6AzRVndzqcUh6sFIauzA==", "dependencies": { - "@remix-run/router": "1.15.3" + "@remix-run/router": "1.16.0" }, "engines": { "node": ">=14.0.0" @@ -11990,12 +11990,12 @@ } }, "node_modules/react-router-dom": { - "version": "6.22.3", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.3.tgz", - "integrity": "sha512-7ZILI7HjcE+p31oQvwbokjk6OA/bnFxrhJ19n82Ex9Ph8fNAq+Hm/7KchpMGlTgWhUxRHMMCut+vEtNpWpowKw==", + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.23.0.tgz", + "integrity": "sha512-Q9YaSYvubwgbal2c9DJKfx6hTNoBp3iJDsl+Duva/DwxoJH+OTXkxGpql4iUK2sla/8z4RpjAm6EWx1qUDuopQ==", "dependencies": { - "@remix-run/router": "1.15.3", - "react-router": "6.22.3" + "@remix-run/router": "1.16.0", + "react-router": "6.23.0" }, "engines": { "node": ">=14.0.0" diff --git a/package.json b/package.json index 490e32601..d8c3c8237 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-frame-component": "^4.1.3", - "react-router-dom": "6.22.3", + "react-router-dom": "6.23.0", "sanitize-filename": "1.6.3", "superagent": "^8.1.2", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" From 86be90adb21902d7f46683855d0a39281e500300 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:28:34 +0000 Subject: [PATCH 18/18] Bump formidable, superagent and supertest Bumps [formidable](https://github.com/node-formidable/formidable) to 3.5.1 and updates ancestor dependencies [formidable](https://github.com/node-formidable/formidable), [superagent](https://github.com/ladjs/superagent) and [supertest](https://github.com/ladjs/supertest). These dependencies need to be updated together. Updates `formidable` from 2.1.2 to 3.5.1 - [Release notes](https://github.com/node-formidable/formidable/releases) - [Changelog](https://github.com/node-formidable/formidable/blob/master/CHANGELOG.md) - [Commits](https://github.com/node-formidable/formidable/commits/v3.5.1) Updates `superagent` from 8.1.2 to 9.0.1 - [Release notes](https://github.com/ladjs/superagent/releases) - [Changelog](https://github.com/ladjs/superagent/blob/master/HISTORY.md) - [Commits](https://github.com/ladjs/superagent/compare/v8.1.2...v9.0.1) Updates `supertest` from 6.3.4 to 7.0.0 - [Release notes](https://github.com/ladjs/supertest/releases) - [Commits](https://github.com/ladjs/supertest/compare/v6.3.4...v7.0.0) --- updated-dependencies: - dependency-name: formidable dependency-type: indirect - dependency-name: superagent dependency-type: direct:production - dependency-name: supertest dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package-lock.json | 33 ++++++++++++++++----------------- package.json | 4 ++-- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index a98fb8fa0..13ef98bd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "react-frame-component": "^4.1.3", "react-router-dom": "6.23.0", "sanitize-filename": "1.6.3", - "superagent": "^8.1.2", + "superagent": "^9.0.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" }, "devDependencies": { @@ -58,7 +58,7 @@ "stylelint-config-recess-order": "^4.6.0", "stylelint-config-recommended": "^13.0.0", "stylelint-stylistic": "^0.4.3", - "supertest": "^6.3.4" + "supertest": "^7.0.0" }, "engines": { "node": "^20.8.x", @@ -6516,14 +6516,13 @@ } }, "node_modules/formidable": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", - "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", + "integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==", "dependencies": { "dezalgo": "^1.0.4", "hexoid": "^1.0.0", - "once": "^1.4.0", - "qs": "^6.11.0" + "once": "^1.4.0" }, "funding": { "url": "https://ko-fi.com/tunnckoCore/commissions" @@ -13598,23 +13597,23 @@ } }, "node_modules/superagent": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.1.2.tgz", - "integrity": "sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-9.0.1.tgz", + "integrity": "sha512-CcRSdb/P2oUVaEpQ87w9Obsl+E9FruRd6b2b7LdiBtJoyMr2DQt7a89anAfiX/EL59j9b2CbRFvf2S91DhuCww==", "dependencies": { "component-emitter": "^1.3.0", "cookiejar": "^2.1.4", "debug": "^4.3.4", "fast-safe-stringify": "^2.1.1", "form-data": "^4.0.0", - "formidable": "^2.1.2", + "formidable": "^3.5.1", "methods": "^1.1.2", "mime": "2.6.0", "qs": "^6.11.0", "semver": "^7.3.8" }, "engines": { - "node": ">=6.4.0 <13 || >=14" + "node": ">=14.18.0" } }, "node_modules/superagent/node_modules/lru-cache": { @@ -13659,16 +13658,16 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/supertest": { - "version": "6.3.4", - "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.3.4.tgz", - "integrity": "sha512-erY3HFDG0dPnhw4U+udPfrzXa4xhSG+n4rxfRuZWCUvjFWwKl+OxWf/7zk50s84/fAAs7vf5QAb9uRa0cCykxw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-7.0.0.tgz", + "integrity": "sha512-qlsr7fIC0lSddmA3tzojvzubYxvlGtzumcdHgPwbFWMISQwL22MhM2Y3LNt+6w9Yyx7559VW5ab70dgphm8qQA==", "dev": true, "dependencies": { "methods": "^1.1.2", - "superagent": "^8.1.2" + "superagent": "^9.0.1" }, "engines": { - "node": ">=6.4.0" + "node": ">=14.18.0" } }, "node_modules/supports-color": { diff --git a/package.json b/package.json index 2d5df4c0b..e316bc14b 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "react-frame-component": "^4.1.3", "react-router-dom": "6.23.0", "sanitize-filename": "1.6.3", - "superagent": "^8.1.2", + "superagent": "^9.0.1", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" }, "devDependencies": { @@ -129,6 +129,6 @@ "stylelint-config-recess-order": "^4.6.0", "stylelint-config-recommended": "^13.0.0", "stylelint-stylistic": "^0.4.3", - "supertest": "^6.3.4" + "supertest": "^7.0.0" } }