Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ runs:
id: check-changed-files
env:
ACTION_REF: ${{ github.action_ref }}
ACTION_SHA: ${{ github.action_sha }}
run: |
# Check if curl is installed, if not install it
if ! command -v curl &> /dev/null; then
Expand All @@ -58,7 +59,22 @@ runs:
if [ -n "${{ inputs.github_user_token }}" ]; then
AUTH_PREFIX="oauth2:${{ inputs.github_user_token }}@"
fi
curl -s -L -o /tmp/check_changed_files.py https://${AUTH_PREFIX}raw.githubusercontent.com/ZPascal/check-changed-files-action/refs/heads/$ACTION_REF/src/check_changed_files.py

# Determine the correct ref (commit SHA, tag, branch, or default to main)
if [ -n "$ACTION_SHA" ]; then
# Use commit SHA as primary reference (always valid)
REF_PATH="$ACTION_SHA"
elif [ -n "$ACTION_REF" ]; then
# Extract the actual ref name from refs/tags/* or refs/heads/*
# ACTION_REF format: refs/tags/v1.0.0 or refs/heads/main
REF_PATH="${ACTION_REF#refs/tags/}"
REF_PATH="${REF_PATH#refs/heads/}"
else
# Fallback to main branch
REF_PATH="main"
fi

curl -s -L -o /tmp/check_changed_files.py "https://${AUTH_PREFIX}raw.githubusercontent.com/ZPascal/check-changed-files-action/$REF_PATH/src/check_changed_files.py"

optional_flags=""
if [ -n "${{ inputs.git_location }}" ]; then
Expand Down