Skip to content

Commit bf2f8d0

Browse files
committed
try adding auto-close behavior
1 parent f241c0c commit bf2f8d0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: close-charts
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
check-and-close:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
contents: read
13+
14+
steps:
15+
- name: Check for modified chart doc files
16+
id: check
17+
run: |
18+
echo "Checking for modified files..."
19+
CHANGED_FILES=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --jq '.[].filename')
20+
21+
echo "$CHANGED_FILES" | grep -E '^src/content/docs/charts/' && echo "found=true" >> $GITHUB_OUTPUT || echo "found=false" >> $GITHUB_OUTPUT
22+
env:
23+
GH_TOKEN: ${{ github.token }}
24+
25+
- name: Close PR if chart docs were modified
26+
if: steps.check.outputs.found == 'true'
27+
run: |
28+
gh pr comment ${{ github.event.pull_request.number }} --body 'Changes to chart docs cannot be submitted here.
29+
They need to be submitted to https://github.com/trueforge-org/truecharts instead'
30+
31+
gh pr close ${{ github.event.pull_request.number }}
32+
env:
33+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)