Skip to content

Commit 193feb2

Browse files
committed
Switch spam detection to PR content
1 parent 81f00a6 commit 193feb2

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Thanks for creating a Pull Request! Before you submit, please make sure
33
you've done the following:
44
5+
- DO NOT submit your own website content.
6+
This repository is for the Minimal Mistakes Jekyll theme only.
57
- Read the contributing document at https://github.com/mmistakes/minimal-mistakes#contributing
68
-->
79

@@ -22,9 +24,5 @@
2224
## Context
2325

2426
<!--
25-
Is this related to any GitHub issue(s)?
26-
-->
27-
28-
<!--
29-
Please confirm that you want to submit this Pull Request to Minimal Mistakes, the free Jekyll theme by Michael Rose, by deleting this comment block.
27+
Is this related to any GitHub issue?
3028
-->

.github/workflows/bad-pr.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,32 @@ jobs:
1212
permissions:
1313
pull-requests: write
1414
runs-on: ubuntu-latest
15-
if: "contains(github.event.pull_request.body, 'by deleting this comment block') || github.event.pull_request.body == ''"
1615
steps:
16+
- uses: actions/checkout@v7
17+
with:
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
fetch-depth: 1
20+
persist-credentials: false
21+
sparse-checkout: |
22+
_config.yml
23+
- id: config
24+
shell: ruby {0}
25+
run: |
26+
require "yaml"
27+
28+
config = YAML.safe_load(File.read("_config.yml"), aliases: true) || {}
29+
customized = !config.fetch("url", nil).nil?
30+
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") do |file|
31+
file.puts("customized=#{customized}")
32+
end
1733
- uses: actions-ecosystem/action-add-labels@v1
34+
if: steps.config.outputs.customized == 'false'
1835
with:
1936
labels: |
2037
Type: Invalid
2138
Type: Spam
2239
- uses: superbrothers/close-pull-request@v3
40+
if: steps.config.outputs.customized == 'false'
2341
with:
2442
# Optional. Post an issue comment just before closing a pull request.
2543
comment: |
@@ -28,7 +46,8 @@ jobs:
2846
[1]: https://mmistakes.github.io/minimal-mistakes/
2947
[2]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
3048
- uses: sudo-bot/action-pull-request-lock@v2
49+
if: steps.config.outputs.customized == 'false'
3150
with:
32-
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
github-token: ${{ github.token }}
3352
number: ${{ github.event.pull_request.number }}
3453
lock-reason: spam

0 commit comments

Comments
 (0)