Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98ce691ee3 | ||
|
|
abd5c01a4d | ||
|
|
f97486922d | ||
|
|
a34577c63e | ||
|
|
04cd48bddf | ||
|
|
2de99109b2 | ||
|
|
7f082ab428 | ||
|
|
782b6b1816 | ||
|
|
6a097ea13d | ||
|
|
bac719afe5 | ||
|
|
58ecc16393 | ||
|
|
0f9f6c2d95 |
18
.github/workflows/latest.yml
vendored
Normal file
18
.github/workflows/latest.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
name: Add latest tag to new release
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: Add/update tag to new release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Run latest-tag
|
||||
uses: EndBug/latest-tag@latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
15
README.md
15
README.md
@@ -11,12 +11,14 @@ Add a step like this to your workflow:
|
||||
|
||||
```yaml
|
||||
- name: Commit changes # This is the step name that will be displayed in your runs
|
||||
uses: EndBug/add-and-commit@v1.0.0 # You can change this to use a specific version
|
||||
uses: EndBug/add-and-commit@v2.1.0 # You can change this to use a specific version
|
||||
with: # See more info about inputs below
|
||||
author_name: Your Name
|
||||
author_email: mail@example.com
|
||||
message: "Your commit message"
|
||||
path: ./*.js
|
||||
path: "."
|
||||
pattern: "*.js"
|
||||
force: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
|
||||
```
|
||||
@@ -26,7 +28,9 @@ Add a step like this to your workflow:
|
||||
- `author_name` : the name 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
|
||||
- `path` : the path to stage files from
|
||||
- `path` : the path(s) to stage files from
|
||||
- `pattern` : the pattern that matches file names
|
||||
- `force` : whether to use the force option on git add, in order to bypass eventual gitignores
|
||||
|
||||
### Environment variables:
|
||||
|
||||
@@ -61,12 +65,13 @@ jobs:
|
||||
run: eslint "src/**" --fix
|
||||
|
||||
- name: Commit changes
|
||||
uses: EndBug/add-and-commit@v1.0.0
|
||||
uses: EndBug/add-and-commit@v2.1.0
|
||||
with:
|
||||
author_name: Your Name
|
||||
author_email: mail@example.com
|
||||
message: "Your commit message"
|
||||
path: ./*.js
|
||||
path: "."
|
||||
pattern: "*.js"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
12
action.yml
12
action.yml
@@ -10,6 +10,10 @@ inputs:
|
||||
description: 'The email of the user that will be displayed as the author of the commit'
|
||||
required: true
|
||||
default: 'actions@github.com'
|
||||
force:
|
||||
description: 'Whether to use the force option on git add, in order to bypass eventual gitignores'
|
||||
required: false
|
||||
default: false
|
||||
message:
|
||||
description: 'The message for the commit'
|
||||
required: true
|
||||
@@ -17,8 +21,12 @@ inputs:
|
||||
path:
|
||||
description: 'The path to stage files from'
|
||||
required: true
|
||||
default: './**/*.*'
|
||||
|
||||
default: '.'
|
||||
pattern:
|
||||
description: 'The pattern that mathces file names'
|
||||
required: false
|
||||
default: "*.*"
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set -eu
|
||||
|
||||
# Set up .netrc file with GitHub credentials
|
||||
git_setup ( ) {
|
||||
git_setup() {
|
||||
cat <<- EOF > $HOME/.netrc
|
||||
machine github.com
|
||||
login $GITHUB_ACTOR
|
||||
@@ -18,9 +18,16 @@ EOF
|
||||
git config --global user.name "Add & Commit GitHub Action"
|
||||
}
|
||||
|
||||
add() {
|
||||
if $INPUT_FORCE
|
||||
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
|
||||
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
|
||||
fi
|
||||
}
|
||||
|
||||
# This is needed to make the check work for untracked files
|
||||
echo "Staging files in commit path..."
|
||||
git add "${INPUT_PATH}"
|
||||
add
|
||||
|
||||
echo "Checking for uncommitted changes in the git working tree..."
|
||||
# This section only runs if there have been file changes
|
||||
@@ -36,7 +43,7 @@ then
|
||||
git checkout "${GITHUB_REF:11}"
|
||||
|
||||
echo "Adding files..."
|
||||
git add "${INPUT_PATH}"
|
||||
add
|
||||
|
||||
echo "Creating commit..."
|
||||
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
|
||||
|
||||
Reference in New Issue
Block a user