-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (30 loc) · 1.27 KB
/
show_edited_folders.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Identify Modified Docs Subfolders
on:
pull_request:
branches:
- traduzioni
types: [opened, synchronize]
jobs:
check-modified-subfolders:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Get list of modified files in docs
id: modified_files
run: |
# Get list of modified or added files within the docs folder
MODIFIED_FILES=$(git diff --name-only origin/traduzioni HEAD | grep '^docs/' || echo "")
echo "Modified files: $MODIFIED_FILES"
# Extract subfolders from the list of modified files
MODIFIED_SUBFOLDERS=$(echo "$MODIFIED_FILES" | awk -F'/' '{print $1"/"$2}' | sort -u)
echo "Modified subfolders: $MODIFIED_SUBFOLDERS"
# Set output variable
echo "subfolders=$MODIFIED_SUBFOLDERS" >> $GITHUB_OUTPUT
- name: Post comment on PR with modified subfolders
if: steps.modified_files.outputs.subfolders != ''
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
message: |
### Modified subfolders in 'docs':
${{ steps.modified_files.outputs.subfolders }}