Skip to content

Commit 64879f0

Browse files
authored
Merge pull request #14 from LuisLiraC/feat/multiline-input
Allow multiline patterns
2 parents 024c2ee + 3101007 commit 64879f0

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ Examples:
1818
- `src/**/*`: All files within the `src` directory and its subdirectories
1919
- `!README.md`: Exclude the README.md file
2020

21+
Patterns could be a single line or multiline string.
22+
```yaml
23+
patterns: |
24+
*.rs
25+
src/**/*
26+
!README.md
27+
```
28+
```yaml
29+
patterns: '*.rs,src/**/*,!README.md'
30+
```
31+
2132
## Outputs
2233
2334
### `DIFF_FILES`
@@ -56,4 +67,4 @@ jobs:
5667
```
5768

5869
> [!WARNING]
59-
> 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.
70+
> 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.

action.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ runs:
1818
shell: bash
1919
run: |
2020
BIN_URL=$(curl https://api.github.com/repos/LuisLiraC/git-diff/releases/latest | jq -r '.assets[0].browser_download_url')
21-
echo "Downloading from $BIN_URL"
22-
curl -L $BIN_URL -o rust-binary.tgz
21+
curl -s -L $BIN_URL -o rust-binary.tgz
2322
tar -xzvf rust-binary.tgz
2423
mv ./Linux/git-diff ./git-diff
2524
2625
- name: Run git-diff
2726
id: get-git-diff
2827
shell: bash
2928
run: |
30-
./git-diff --patterns='${{ inputs.patterns }}'
29+
PATTERNS="${{ inputs.patterns }}"
30+
COMMA_SEPARATED_PATTERNS=$(echo "$PATTERNS" | tr '\n' ',' | sed -e 's/,$//' | sed 's/,$//' | sed 's/ //g')
31+
echo "Files patterns: $COMMA_SEPARATED_PATTERNS"
32+
33+
./git-diff --patterns=$COMMA_SEPARATED_PATTERNS

0 commit comments

Comments
 (0)