diff --git a/README.md b/README.md index 1c91ce9..5409568 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This GitHub Action checks for changed files in a Git repository and validates th | checked_location | Enter the location of the files, separated by `;`. Example: `src/;docs/test.txt;tests/test*` | true | | | git_location | Path to the Git repository. | false | (current working directory) | | check_all_files | Enables the check of all defined files and folders in the directory. | false | false | +| github_user_token | Define the used GitHub server user token for Github.com. | false | "" | --- diff --git a/action.yml b/action.yml index 3651e50..a971657 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,10 @@ inputs: description: "Enables the check of all defined files and folders in the directory" default: "false" required: false + github_user_token: + description: "Define the used GitHub server user token for Github.com" + default: "" + required: false outputs: files_changed: description: "Returns true if changed files are detected and false by default" @@ -50,8 +54,11 @@ runs: # Download the check_changed_files.py script echo "Downloading check_changed_files.py script..." - echo $ACTION_REF - curl -s -L -o /tmp/check_changed_files.py https://raw.githubusercontent.com/ZPascal/check-changed-files-action/refs/heads/$ACTION_REF/src/check_changed_files.py + AUTH_PREFIX="" + 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 optional_flags="" if [ -n "${{ inputs.git_location }}" ]; then