From 165ca64e35817ab77070a6ef947a332e5f1a8ebd Mon Sep 17 00:00:00 2001 From: christian-calabrese Date: Fri, 11 Oct 2024 12:05:39 +0200 Subject: [PATCH] feat: added workflow --- .github/workflows/show_edited_folders.yaml | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/show_edited_folders.yaml diff --git a/.github/workflows/show_edited_folders.yaml b/.github/workflows/show_edited_folders.yaml new file mode 100644 index 00000000..26f213a4 --- /dev/null +++ b/.github/workflows/show_edited_folders.yaml @@ -0,0 +1,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 }} \ No newline at end of file