Skip to content

Commit d6c8f97

Browse files
committed
feat: Add new workflow to block direct module reference changes
1 parent 45d2012 commit d6c8f97

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/block-changes.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Block specific changes
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
block-direct-markdown-module-changes:
8+
name: Block modifying Markdown Module Reference files directly
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # v4.2.2
13+
- name: Check for changes in /nginx/module_reference
14+
id: check_module_changes
15+
run: |
16+
FOLDER_DIR="/content/nginx/module_reference"
17+
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q "^$FOLDER_DIR/"; then
18+
echo "Changes detected in $FOLDER_DIR"
19+
echo "CHANGES_DETECTED=true" >> $GITHUB_OUTPUT
20+
fi
21+
22+
echo "CHANGES_DETECTED=true" >> $GITHUB_OUTPUT
23+
- name: Fail job and generate PR comment if changes detected
24+
if: steps.check_module_changes.outputs.CHANGES_DETECTED == 'true'
25+
run: |
26+
echo "Hi"

0 commit comments

Comments
 (0)