diff --git a/README.md b/README.md index 198d3b6..40a845a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,17 @@ Examples: - `src/**/*`: All files within the `src` directory and its subdirectories - `!README.md`: Exclude the README.md file +Patterns could be a single line or multiline string. +```yaml +patterns: | + *.rs + src/**/* + !README.md +``` +```yaml +patterns: '*.rs,src/**/*,!README.md' +``` + ## Outputs ### `DIFF_FILES` @@ -56,4 +67,4 @@ jobs: ``` > [!WARNING] -> At this moment it only works with the `pull_request` event. It uses the `GITHUB_BASE_REF` environment variable to get the base branch of the PR and this environment variable is only available in the `pull_request` event. +> At this moment it only works with the `pull_request` event. It uses the `GITHUB_BASE_REF` environment variable to get the base branch of the PR and this it is only available in the `pull_request` event. diff --git a/action.yaml b/action.yaml index 95e4b1e..4241b17 100644 --- a/action.yaml +++ b/action.yaml @@ -18,8 +18,7 @@ runs: shell: bash run: | BIN_URL=$(curl https://api.github.com/repos/LuisLiraC/git-diff/releases/latest | jq -r '.assets[0].browser_download_url') - echo "Downloading from $BIN_URL" - curl -L $BIN_URL -o rust-binary.tgz + curl -s -L $BIN_URL -o rust-binary.tgz tar -xzvf rust-binary.tgz mv ./Linux/git-diff ./git-diff @@ -27,4 +26,8 @@ runs: id: get-git-diff shell: bash run: | - ./git-diff --patterns='${{ inputs.patterns }}' + PATTERNS="${{ inputs.patterns }}" + COMMA_SEPARATED_PATTERNS=$(echo "$PATTERNS" | tr '\n' ',' | sed -e 's/,$//' | sed 's/,$//' | sed 's/ //g') + echo "Files patterns: $COMMA_SEPARATED_PATTERNS" + + ./git-diff --patterns=$COMMA_SEPARATED_PATTERNS