From 57e1d2d499fccd5e324febf9d20499046385b431 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 25 May 2025 15:42:16 -0600 Subject: [PATCH 1/4] fix(github-actions): add filesystem UID/GID fixer after action modifies the github workspace --- src/gh_action/action.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/gh_action/action.sh b/src/gh_action/action.sh index cd862d9a9..7ae58f68d 100644 --- a/src/gh_action/action.sh +++ b/src/gh_action/action.sh @@ -2,6 +2,8 @@ set -e +WORKSPACE_DIR="$(pwd)" + explicit_run_cmd() { local cmd="" cmd="$(printf '%s' "$*" | sed 's/^ *//g' | sed 's/ *$//g')" @@ -49,6 +51,20 @@ eval_string_input() { printf '%s' "${if_defined/\%s/$value}" } +# Capture UID and GID of the external filesystem +if [ ! -f "$WORKSPACE_DIR/.git/HEAD" ]; then + echo "::error:: .git/HEAD file not found. Ensure you are in a valid git repository." + exit 1 +fi + +EXT_HOST_UID="$(stat -c '%u' "$WORKSPACE_DIR/.git/HEAD")" +EXT_HOST_GID="$(stat -c '%g' "$WORKSPACE_DIR/.git/HEAD")" + +if [ -z "$EXT_HOST_UID" ] || [ -z "$EXT_HOST_GID" ]; then + echo "Error: Unable to determine external filesystem UID/GID from .git/HEAD" + exit 1 +fi + # Convert inputs to command line arguments ROOT_OPTIONS=() @@ -165,5 +181,9 @@ export GH_TOKEN="${INPUT_GITHUB_TOKEN}" # normalize extra spaces into single spaces as you combine the arguments CMD_ARGS="$(printf '%s' "${ROOT_OPTIONS[*]} version ${ARGS[*]}" | sed 's/ [ ]*/ /g' | sed 's/^ *//g')" +# Make sure the workspace directory is owned by the external filesystem UID/GID no matter what +# This is to ensure that after the action, and a commit was created, the files are owned by the external filesystem +trap "chown -R $EXT_HOST_UID:$EXT_HOST_GID '$WORKSPACE_DIR'" EXIT + # Run Semantic Release (explicitly use the GitHub action version) explicit_run_cmd "$PSR_VENV_BIN/semantic-release $CMD_ARGS" From 8e496bcd7d55efdec2a3b5a71fdde6c008041dc9 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 25 May 2025 19:59:35 -0600 Subject: [PATCH 2/4] ci(validate): fix job condition on github-action testing --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 053448561..89535f255 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -393,7 +393,7 @@ jobs: test-gh-action: name: Validate Action Build & Execution runs-on: ubuntu-latest - if: inputs.gha-src-files-changed == 'true' || inputs.gha-test-files-changed == 'true' || inputs.ci-files-changed == 'true' + if: ${{ inputs.gha-src-files-changed == 'true' || inputs.gha-test-files-changed == 'true' || inputs.ci-files-changed == 'true' }} needs: - build From 74456408acac75c5094f7003a2d1cc1358fb35a6 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 25 May 2025 20:01:28 -0600 Subject: [PATCH 3/4] ci(release): remove filesystem error check detection - debug flag --- .github/workflows/cicd.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index e4b35a055..afac890bd 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -165,7 +165,6 @@ jobs: GIT_COMMITTER_NAME: ${{ env.GITHUB_ACTIONS_AUTHOR_NAME }} GIT_COMMITTER_EMAIL: ${{ env.GITHUB_ACTIONS_AUTHOR_EMAIL }} run: | - ls -la .git/ MINOR_VERSION_TAG="$(echo "$FULL_VERSION_TAG" | cut -d. -f1,2)" git tag --force --annotate "$MINOR_VERSION_TAG" "${FULL_VERSION_TAG}^{}" -m "$MINOR_VERSION_TAG" git push -u origin "$MINOR_VERSION_TAG" --force From 38e07edc196df2a6fa07a45f9391c8ec2a70a93c Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 25 May 2025 20:03:05 -0600 Subject: [PATCH 4/4] ci(deps): temporarily use the current HEAD github action to release psr --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index afac890bd..f63564b7c 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -145,7 +145,7 @@ jobs: - name: Release | Python Semantic Release id: release - uses: python-semantic-release/python-semantic-release@917a2c730cb8f6c8cd3d00f23c876d724a4a844c # v10.0.1 + uses: ./ with: github_token: ${{ secrets.GITHUB_TOKEN }} verbosity: 1