From 150c178341fa00247ad9092e2a7b6968e6ed4779 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 09:31:31 +0700 Subject: [PATCH 1/7] chore: check file permissions on GH --- .github/workflows/test-file-permissions.yml | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml index e6ad5949d8b4..79f09a7801e8 100644 --- a/.github/workflows/test-file-permissions.yml +++ b/.github/workflows/test-file-permissions.yml @@ -20,5 +20,31 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: intl + coverage: none + + - name: Use latest Composer + run: composer self-update + + - name: Validate composer.json + run: composer validate --strict + + - name: Get composer cache directory + run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ env.COMPOSER_CACHE_FILES_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer update --ansi --no-interaction + - name: Detect unnecessary execution permissions run: php utils/check_permission_x.php From ffee2a319a831d70e254ddfa01e3bbc988bead45 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 09:36:07 +0700 Subject: [PATCH 2/7] refactor: using PHP 8.4 instead --- .github/workflows/test-file-permissions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml index 79f09a7801e8..ed26caf51e88 100644 --- a/.github/workflows/test-file-permissions.yml +++ b/.github/workflows/test-file-permissions.yml @@ -23,7 +23,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.4' extensions: intl coverage: none From 6e86eff85b2b0faec31934a086890728a19c7d0a Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 09:42:28 +0700 Subject: [PATCH 3/7] fix: exclude `utils/vendor` --- utils/check_permission_x.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/check_permission_x.php b/utils/check_permission_x.php index 84f4b00a1b1a..9d17d8df3539 100644 --- a/utils/check_permission_x.php +++ b/utils/check_permission_x.php @@ -34,6 +34,7 @@ function findExecutableFiles($dir) 'admin/starter/builds', 'user_guide_src/add-edit-this-page', ]; + $excludeFolder = 'utils/vendor'; $executableFiles = []; @@ -53,6 +54,10 @@ function findExecutableFiles($dir) if ($fileinfo->isFile() && is_executable($fileinfo->getPathname())) { $filePath = $fileinfo->getPathname(); + if (str_contains($filePath, $excludeFolder)) { + continue; + } + // Check allow list if (in_array($filePath, $execFileList, true)) { continue; From 7f4ef670c742c9144fad05c74c8b3acb237971c5 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 10:09:44 +0700 Subject: [PATCH 4/7] fix: checkout action --- .github/workflows/test-file-permissions.yml | 22 +++------------------ 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml index ed26caf51e88..0812bdf56b55 100644 --- a/.github/workflows/test-file-permissions.yml +++ b/.github/workflows/test-file-permissions.yml @@ -19,6 +19,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -27,24 +30,5 @@ jobs: extensions: intl coverage: none - - name: Use latest Composer - run: composer self-update - - - name: Validate composer.json - run: composer validate --strict - - - name: Get composer cache directory - run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ${{ env.COMPOSER_CACHE_FILES_DIR }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer update --ansi --no-interaction - - name: Detect unnecessary execution permissions run: php utils/check_permission_x.php From aa914c88d300ed70ebeb08c98836a2ffeaea1ea0 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 10:13:25 +0700 Subject: [PATCH 5/7] fix: empty ref on checkout --- .github/workflows/test-file-permissions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml index 0812bdf56b55..9614915df3da 100644 --- a/.github/workflows/test-file-permissions.yml +++ b/.github/workflows/test-file-permissions.yml @@ -20,7 +20,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.ref_name }} + ref: '' fetch-depth: 0 - name: Setup PHP From ea13e87356afe0190d241939b10a472bfa8de377 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 10:29:51 +0700 Subject: [PATCH 6/7] fix: remove depth --- .github/workflows/test-file-permissions.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml index 9614915df3da..a443e25cb212 100644 --- a/.github/workflows/test-file-permissions.yml +++ b/.github/workflows/test-file-permissions.yml @@ -20,8 +20,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: '' - fetch-depth: 0 + ref: ${{ github.ref }} - name: Setup PHP uses: shivammathur/setup-php@v2 From 2e04e62f9317a0b1033c866f4d44b58d803eb45b Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 14 May 2025 10:34:31 +0700 Subject: [PATCH 7/7] Update test-file-permissions.yml --- .github/workflows/test-file-permissions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml index a443e25cb212..c95d8bc16b51 100644 --- a/.github/workflows/test-file-permissions.yml +++ b/.github/workflows/test-file-permissions.yml @@ -20,7 +20,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.ref }} + ref: develop - name: Setup PHP uses: shivammathur/setup-php@v2