Merge pull request #2 from EndBug/better-paths

Add patterns
This commit is contained in:
Federico Grandi
2019-09-18 23:01:21 +02:00
committed by GitHub
3 changed files with 14 additions and 7 deletions

View File

@@ -11,12 +11,13 @@ Add a step like this to your workflow:
```yaml ```yaml
- name: Commit changes # This is the step name that will be displayed in your runs - name: Commit changes # This is the step name that will be displayed in your runs
uses: EndBug/add-and-commit@latest # You can change this to use a specific version uses: EndBug/add-and-commit@v2.0.0 # You can change this to use a specific version
with: # See more info about inputs below with: # See more info about inputs below
author_name: Your Name author_name: Your Name
author_email: mail@example.com author_email: mail@example.com
message: "Your commit message" message: "Your commit message"
path: ./*.js path: "."
pattern: "*.js"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
``` ```
@@ -27,6 +28,7 @@ Add a step like this to your workflow:
- `author_email` : the email of the user that will be displayed as the author of the commit - `author_email` : the email of the user that will be displayed as the author of the commit
- `message` : the message for the commit - `message` : the message for the commit
- `path` : the path(s) to stage files from - `path` : the path(s) to stage files from
- `pattern` : the pattern that matches file names
### Environment variables: ### Environment variables:
@@ -61,12 +63,13 @@ jobs:
run: eslint "src/**" --fix run: eslint "src/**" --fix
- name: Commit changes - name: Commit changes
uses: EndBug/add-and-commit@latest uses: EndBug/add-and-commit@v2.0.0
with: with:
author_name: Your Name author_name: Your Name
author_email: mail@example.com author_email: mail@example.com
message: "Your commit message" message: "Your commit message"
path: ./*.js path: "."
pattern: "*.js"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```

View File

@@ -17,8 +17,12 @@ inputs:
path: path:
description: 'The path to stage files from' description: 'The path to stage files from'
required: true required: true
default: './**/*.*' default: '.'
pattern:
description: 'The pattern that mathces file names'
required: false
default: "*.*"
runs: runs:
using: 'docker' using: 'docker'
image: 'Dockerfile' image: 'Dockerfile'

View File

@@ -19,7 +19,7 @@ EOF
} }
add() { add() {
find $INPUT_PATH -name "*.*" | while read x; do git add $x; done find $INPUT_PATH -name $INPUT_PATTERN | while read x; do git add $x; done
} }
# This is needed to make the check work for untracked files # This is needed to make the check work for untracked files