diff --git a/.github/workflows/vscode-publish-extensions.yml b/.github/workflows/vscode-publish-extensions.yml index 3faf70c..babcf88 100644 --- a/.github/workflows/vscode-publish-extensions.yml +++ b/.github/workflows/vscode-publish-extensions.yml @@ -103,6 +103,16 @@ on: required: false default: '22.x' type: string + git-user-name: + description: 'Git user name for version bump commits' + required: false + default: 'GitHub Action' + type: string + git-user-email: + description: 'Git user email for version bump commits' + required: false + default: 'action@github.com' + type: string # Add explicit permissions for security permissions: @@ -463,9 +473,25 @@ jobs: else echo "🔄 Committing version bumps..." - # Configure git for the action - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + # Validate git identity inputs (prevent empty strings from overriding defaults) + GIT_USER_NAME="${{ inputs.git-user-name }}" + GIT_USER_EMAIL="${{ inputs.git-user-email }}" + + if [ -z "$GIT_USER_NAME" ]; then + echo "⚠️ git-user-name is empty, using default: GitHub Action" + GIT_USER_NAME="GitHub Action" + fi + + if [ -z "$GIT_USER_EMAIL" ]; then + echo "⚠️ git-user-email is empty, using default: action@github.com" + GIT_USER_EMAIL="action@github.com" + fi + + # Configure git for the action (using -c flag for safer parameter passing) + export GIT_AUTHOR_NAME="$GIT_USER_NAME" + export GIT_AUTHOR_EMAIL="$GIT_USER_EMAIL" + export GIT_COMMITTER_NAME="$GIT_USER_NAME" + export GIT_COMMITTER_EMAIL="$GIT_USER_EMAIL" # Configure git to use the PAT for authentication git remote set-url origin https://x-access-token:${{ secrets.IDEE_GH_TOKEN }}@github.com/${{ github.repository }}.git