Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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.
9 changes: 6 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ 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

- name: Run git-diff
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