Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba88a0e80a | ||
|
|
e5287e06b1 | ||
|
|
7f650514d7 | ||
|
|
cba6741f01 | ||
|
|
30237071ab | ||
|
|
ff395b9380 | ||
|
|
29f94b7cce | ||
|
|
d4d066316a | ||
|
|
780b0df14e | ||
|
|
91b0f62409 | ||
|
|
f7edecabb7 | ||
|
|
68e252f6d5 | ||
|
|
22a5148239 | ||
|
|
f1e4faf559 | ||
|
|
a54a7342a8 | ||
|
|
6d81b3b072 | ||
|
|
5bf17ab674 | ||
|
|
1308272399 | ||
|
|
998652d28d | ||
|
|
66ecef4789 | ||
|
|
cbc4f17c16 | ||
|
|
ff41bd83fc | ||
|
|
f01349f789 | ||
|
|
0d52df43e8 | ||
|
|
9fc8e267d9 | ||
|
|
b7a37a1d30 | ||
|
|
d93b31c94f | ||
|
|
d56de922da | ||
|
|
d17f9e05d0 | ||
|
|
43f9ed2319 | ||
|
|
ecfc673e49 | ||
|
|
c5ea534638 | ||
|
|
19bc3334a6 | ||
|
|
625465ddfa | ||
|
|
56ba54f5eb | ||
|
|
27b19f81e0 | ||
|
|
d4433a238b | ||
|
|
c6058fcbe2 | ||
|
|
f290181c01 | ||
|
|
4d24efd108 | ||
|
|
89896039c8 | ||
|
|
ed576dbe8c | ||
|
|
8b817249e9 | ||
|
|
34260c9d7c | ||
|
|
02f7344d49 | ||
|
|
05ce3af6f3 | ||
|
|
c6b867bd0b | ||
|
|
4c184a79ea | ||
|
|
4250682bb5 | ||
|
|
8e591a749d | ||
|
|
050a667872 | ||
|
|
7fbfbfa278 | ||
|
|
0b47528fc7 | ||
|
|
a3279e7b72 | ||
|
|
0930a0f6f6 | ||
|
|
0e4f5f6417 | ||
|
|
d67ae5f689 | ||
|
|
2cbf8ebce9 | ||
|
|
6d7bd0506d | ||
|
|
e6dcd77d10 | ||
|
|
43eaf991fc | ||
|
|
61b52dba1f | ||
|
|
f53a7db16d |
@@ -351,6 +351,78 @@
|
|||||||
"contributions": [
|
"contributions": [
|
||||||
"doc"
|
"doc"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "sconix",
|
||||||
|
"name": "Janne Julkunen",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/921515?v=4",
|
||||||
|
"profile": "https://github.com/sconix",
|
||||||
|
"contributions": [
|
||||||
|
"ideas"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Josh-Cena",
|
||||||
|
"name": "Joshua Chen",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/55398995?v=4",
|
||||||
|
"profile": "https://joshcena.com",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Akimon658",
|
||||||
|
"name": "Akimo",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/81888693?v=4",
|
||||||
|
"profile": "http://akimon658.github.io",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "revolunet",
|
||||||
|
"name": "Julien Bouquillon",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/124937?v=4",
|
||||||
|
"profile": "https://revolunet.com",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "AvivPeledTalon",
|
||||||
|
"name": "Aviv Peled",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/92471076?v=4",
|
||||||
|
"profile": "https://github.com/AvivPeledTalon",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "onedr0p",
|
||||||
|
"name": "Devin Buhl",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/213795?v=4",
|
||||||
|
"profile": "https://github.com/onedr0p",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "melink14",
|
||||||
|
"name": "Erek Speed",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1176550?v=4",
|
||||||
|
"profile": "https://erekspeed.com",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "kachkaev",
|
||||||
|
"name": "Alexander Kachkaev",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/608862?v=4",
|
||||||
|
"profile": "https://kachkaev.uk",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 7,
|
"contributorsPerLine": 7,
|
||||||
|
|||||||
10
.github/dependabot.yml
vendored
10
.github/dependabot.yml
vendored
@@ -14,3 +14,13 @@ updates:
|
|||||||
include: 'scope'
|
include: 'scope'
|
||||||
labels:
|
labels:
|
||||||
- 'type: chore'
|
- 'type: chore'
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
commit-message:
|
||||||
|
include: scope
|
||||||
|
prefix: ci
|
||||||
|
labels:
|
||||||
|
- 'type: chore'
|
||||||
|
|||||||
19
.github/stale.yml
vendored
19
.github/stale.yml
vendored
@@ -1,19 +0,0 @@
|
|||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 20
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 5
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- pinned
|
|
||||||
- security
|
|
||||||
- 'status: pinned'
|
|
||||||
- 'type: security'
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: 'status: stale'
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
||||||
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
name: Build
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
- src/**
|
|
||||||
- .github/workflows/build.yml
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build compiled JS version
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 12.x
|
|
||||||
|
|
||||||
- run: npm install
|
|
||||||
|
|
||||||
- run: npm run build
|
|
||||||
|
|
||||||
- uses: EndBug/add-and-commit@v4
|
|
||||||
with:
|
|
||||||
message: '[auto] build: update compiled version'
|
|
||||||
add: lib
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
34
.github/workflows/codeql-analysis.yml
vendored
34
.github/workflows/codeql-analysis.yml
vendored
@@ -29,42 +29,32 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
security-events: write
|
security-events: write
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'javascript' ]
|
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
# Override language selection by uncommenting this and choosing your languages
|
||||||
languages: ${{ matrix.language }}
|
# with:
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# languages: go, javascript, csharp, python, cpp, java
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below).
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following
|
||||||
# and modify them (or add more) to build your code if your project
|
# three lines and modify them (or add more) to build your code if your
|
||||||
# uses a compiled language
|
# project uses a compiled language
|
||||||
|
|
||||||
#- run: |
|
#- run: |
|
||||||
# make bootstrap
|
# make bootstrap
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|||||||
7
.github/workflows/label-sync.yml
vendored
7
.github/workflows/label-sync.yml
vendored
@@ -2,7 +2,7 @@ name: Sync labels
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
paths:
|
paths:
|
||||||
- '.github/labels.yml'
|
- '.github/labels.yml'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -12,8 +12,7 @@ jobs:
|
|||||||
name: Run EndBug/label-sync
|
name: Run EndBug/label-sync
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: EndBug/label-sync@v1
|
- uses: EndBug/label-sync@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
config-file: '.github/labels.yml'
|
config-file: '.github/labels.yml'
|
||||||
|
|||||||
9
.github/workflows/stale.yml
vendored
Normal file
9
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: 'Handle stale issues and PR'
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '00 5,17 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
uses: EndBug/workflows/.github/workflows/stale.yml@main
|
||||||
18
.github/workflows/test.yml
vendored
18
.github/workflows/test.yml
vendored
@@ -6,17 +6,23 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Test build
|
name: Build
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: npm i
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
cache: npm
|
||||||
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Check linting
|
name: Lint
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: npm i
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
cache: npm
|
||||||
|
- run: npm ci
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
|
|||||||
10
.github/workflows/versioning.yml
vendored
10
.github/workflows/versioning.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Keep the versions up-to-date
|
name: Update tags
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@@ -6,10 +6,8 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
actions-tagger:
|
actions-tagger:
|
||||||
runs-on: windows-latest
|
runs-on: windows-2022
|
||||||
steps:
|
steps:
|
||||||
- uses: Actions-R-Us/actions-tagger@v1
|
- uses: Actions-R-Us/actions-tagger@v2
|
||||||
with:
|
with:
|
||||||
publish_latest: true
|
publish_latest_tag: true
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
|
|
||||||
|
|||||||
0
.husky/pre-commit
Normal file → Executable file
0
.husky/pre-commit
Normal file → Executable file
25
CHANGELOG.md
25
CHANGELOG.md
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [9.1.0] - 2022-08-22
|
||||||
|
### Added:
|
||||||
|
- The `fetch` input allows you to customize the `git fetch` command, or to prevent the action from fetching at all.
|
||||||
|
|
||||||
|
## [9.0.1] - 2022-06-26
|
||||||
|
### Fixed:
|
||||||
|
- Now files are re-staged after pulling, so that the action works as intended when using options such as `pull: --rebase --autostash`
|
||||||
|
|
||||||
|
## [9.0.0] - 2022-03-11
|
||||||
|
|
||||||
|
### Changed:
|
||||||
|
|
||||||
|
- **[BREAKING]** The action will now fail when the `git commit` command fails. (#370)
|
||||||
|
- **[BREAKING]** The action won't try deleting and re-creting tags when it fails to push them, it's now up to you to set the proper arguments (see the `tag_push` input). (#367)
|
||||||
|
|
||||||
|
### Added:
|
||||||
|
|
||||||
|
- `tag_push` input: you can now set the arguments of the `git push --tags` command.
|
||||||
|
- `tag_pushed` output: whether the action pushed tags.
|
||||||
|
|
||||||
## [8.0.2] - 2022-02-07
|
## [8.0.2] - 2022-02-07
|
||||||
|
|
||||||
### Fixed:
|
### Fixed:
|
||||||
@@ -305,7 +325,7 @@ First release
|
|||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
[unreleased]: https://github.com/EndBug/add-and-commit/compare/v8.0.2...HEAD
|
[unreleased]: https://github.com/EndBug/add-and-commit/compare/v9.1.0...HEAD
|
||||||
[1.0.0]: https://github.com/EndBug/add-and-commit/tree/v1.0.0
|
[1.0.0]: https://github.com/EndBug/add-and-commit/tree/v1.0.0
|
||||||
[2.0.0]: https://github.com/EndBug/add-and-commit/compare/v1.0.0...v2.0.0
|
[2.0.0]: https://github.com/EndBug/add-and-commit/compare/v1.0.0...v2.0.0
|
||||||
[2.1.0]: https://github.com/EndBug/add-and-commit/compare/v2.0.0...v2.1.0
|
[2.1.0]: https://github.com/EndBug/add-and-commit/compare/v2.0.0...v2.1.0
|
||||||
@@ -346,3 +366,6 @@ First release
|
|||||||
[8.0.0]: https://github.com/EndBug/add-and-commit/compare/v7.5.0...v8.0.0
|
[8.0.0]: https://github.com/EndBug/add-and-commit/compare/v7.5.0...v8.0.0
|
||||||
[8.0.1]: https://github.com/EndBug/add-and-commit/compare/v8.0.0...v8.0.1
|
[8.0.1]: https://github.com/EndBug/add-and-commit/compare/v8.0.0...v8.0.1
|
||||||
[8.0.2]: https://github.com/EndBug/add-and-commit/compare/v8.0.1...v8.0.2
|
[8.0.2]: https://github.com/EndBug/add-and-commit/compare/v8.0.1...v8.0.2
|
||||||
|
[9.0.0]: https://github.com/EndBug/add-and-commit/compare/v8.0.2...v9.0.0
|
||||||
|
[9.0.1]: https://github.com/EndBug/add-and-commit/compare/v9.0.0...v9.0.1
|
||||||
|
[9.1.0]: https://github.com/EndBug/add-and-commit/compare/v9.0.1...v9.1.0
|
||||||
|
|||||||
43
README.md
43
README.md
@@ -1,6 +1,5 @@
|
|||||||
# Add & Commit
|
# Add & Commit
|
||||||
|
|
||||||
[](https://github.com/search?o=desc&q=EndBug+add-and-commit+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code)
|
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
|
|
||||||
You can use this GitHub Action to commit changes made in your workflow run directly to your repo: for example, you use it to lint your code, update documentation, commit updated builds, etc...
|
You can use this GitHub Action to commit changes made in your workflow run directly to your repo: for example, you use it to lint your code, update documentation, commit updated builds, etc...
|
||||||
@@ -18,7 +17,7 @@ You can use this GitHub Action to commit changes made in your workflow run direc
|
|||||||
Add a step like this to your workflow:
|
Add a step like this to your workflow:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: EndBug/add-and-commit@v8 # You can change this to use a specific version.
|
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
|
||||||
with:
|
with:
|
||||||
# The arguments for the `git add` command (see the paragraph below for more info)
|
# The arguments for the `git add` command (see the paragraph below for more info)
|
||||||
# Default: '.'
|
# Default: '.'
|
||||||
@@ -55,6 +54,11 @@ Add a step like this to your workflow:
|
|||||||
# Default: github_actor
|
# Default: github_actor
|
||||||
default_author: github_actor
|
default_author: github_actor
|
||||||
|
|
||||||
|
# Arguments for the git fetch command. If set to false, the action won't fetch the repo.
|
||||||
|
# For more info as to why fetching is usually recommended, please see the "Performance on large repos" FAQ.
|
||||||
|
# Default: --tags --force
|
||||||
|
fetch: false
|
||||||
|
|
||||||
# The message for the commit.
|
# The message for the commit.
|
||||||
# Default: 'Commit from GitHub Actions (name of the workflow)'
|
# Default: 'Commit from GitHub Actions (name of the workflow)'
|
||||||
message: 'Your commit message'
|
message: 'Your commit message'
|
||||||
@@ -85,6 +89,10 @@ Add a step like this to your workflow:
|
|||||||
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
|
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
|
||||||
# Default: ''
|
# Default: ''
|
||||||
tag: 'v1.0.0 --force'
|
tag: 'v1.0.0 --force'
|
||||||
|
|
||||||
|
# Arguments for the git push --tags command (any additional argument will be added after --tags)
|
||||||
|
# Default: ''
|
||||||
|
tag_push: '--force'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Git arguments
|
### Git arguments
|
||||||
@@ -132,6 +140,8 @@ If you want to commit files "across different branches", here are two ways to do
|
|||||||
### Tagging
|
### Tagging
|
||||||
|
|
||||||
You can use the `tag` option to enter the arguments for a `git add` command. In order for the action to isolate the tag name from the rest of the arguments, it should be the first word not preceded by an hyphen (e.g. `-a tag-name -m "some other stuff"` is ok).
|
You can use the `tag` option to enter the arguments for a `git add` command. In order for the action to isolate the tag name from the rest of the arguments, it should be the first word not preceded by an hyphen (e.g. `-a tag-name -m "some other stuff"` is ok).
|
||||||
|
You can also change the arguments of the push command for tags: every argument in the `tag_push` input will be appended to the `git push --tags` command.
|
||||||
|
For more info on how git arguments are parsed, see [the "Git arguments" section](#git-arguments).
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
@@ -142,6 +152,7 @@ The action provides these outputs:
|
|||||||
- `commit_sha`: the short 7-character SHA of the commit that has just been created
|
- `commit_sha`: the short 7-character SHA of the commit that has just been created
|
||||||
- `pushed`: whether the action has pushed to the remote (`'true'` or `'false'`)
|
- `pushed`: whether the action has pushed to the remote (`'true'` or `'false'`)
|
||||||
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
|
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
|
||||||
|
- `tag_pushed`: whether the action has pushed a tag (`'true'` or `'false'`)
|
||||||
|
|
||||||
For more info on how to use outputs, see ["Context and expression syntax"](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions).
|
For more info on how to use outputs, see ["Context and expression syntax"](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions).
|
||||||
|
|
||||||
@@ -194,6 +205,14 @@ Some users reported that they were getting an error:
|
|||||||
|
|
||||||
If you're getting this error and you're using `actions/checkout@v1`, try upgrading to `actions/checkout@v2`. If you're still having problems after upgrading, feel free to open an issue. Issue ref: [#146](https://github.com/EndBug/add-and-commit/issues/146)
|
If you're getting this error and you're using `actions/checkout@v1`, try upgrading to `actions/checkout@v2`. If you're still having problems after upgrading, feel free to open an issue. Issue ref: [#146](https://github.com/EndBug/add-and-commit/issues/146)
|
||||||
|
|
||||||
|
### Performance on large repos
|
||||||
|
|
||||||
|
By default, the action will fetch the repository before starting to work on it: this ensures that it can see the already existing refs.
|
||||||
|
|
||||||
|
When working with a repository that has a lot of branches and tags, fetching it can take a long time. If the fetch step is taking too much time, you can decide to skip it by setting the `fetch` input to `false`: this will prevent the action from running `git fetch` altogether.
|
||||||
|
|
||||||
|
Please note that you have to set up your workflow accordingly: not fetching the repo can impact branch and tag creation within the action, and for this reason it's recommended to disable it only if necessary. Issue ref: [#386](https://github.com/EndBug/add-and-commit/issues/386)
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Different author/committer configurations
|
### Different author/committer configurations
|
||||||
@@ -208,7 +227,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: EndBug/add-and-commit@v8
|
- uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
default_author: github_actions
|
default_author: github_actions
|
||||||
```
|
```
|
||||||
@@ -218,7 +237,7 @@ You can also use the `committer_name` and `committer_email` inputs to make it ap
|
|||||||
<img src="https://user-images.githubusercontent.com/26386270/130594168-1d910710-e2d0-4b06-9324-cbe5dde59154.png" height=70/>
|
<img src="https://user-images.githubusercontent.com/26386270/130594168-1d910710-e2d0-4b06-9324-cbe5dde59154.png" height=70/>
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: EndBug/add-and-commit@v8
|
- uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
message: Show GitHub Actions logo
|
message: Show GitHub Actions logo
|
||||||
committer_name: GitHub Actions
|
committer_name: GitHub Actions
|
||||||
@@ -228,7 +247,7 @@ You can also use the `committer_name` and `committer_email` inputs to make it ap
|
|||||||
<img src="https://user-images.githubusercontent.com/26386270/130594443-b881fae7-3064-4020-a4cc-6db37ef0df65.png" height=70/>
|
<img src="https://user-images.githubusercontent.com/26386270/130594443-b881fae7-3064-4020-a4cc-6db37ef0df65.png" height=70/>
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: EndBug/add-and-commit@v8
|
- uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
message: Show GitHub logo
|
message: Show GitHub logo
|
||||||
committer_name: GitHub Actions
|
committer_name: GitHub Actions
|
||||||
@@ -263,7 +282,7 @@ jobs:
|
|||||||
run: eslint "src/**" --fix
|
run: eslint "src/**" --fix
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: EndBug/add-and-commit@v8
|
uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
author_name: Your Name
|
author_name: Your Name
|
||||||
author_email: mail@example.com
|
author_email: mail@example.com
|
||||||
@@ -294,7 +313,7 @@ jobs:
|
|||||||
- run: echo "123" > ./pathToRepo/file.txt
|
- run: echo "123" > ./pathToRepo/file.txt
|
||||||
|
|
||||||
# ...and then use the action as you would normally do, but providing the path to the repo
|
# ...and then use the action as you would normally do, but providing the path to the repo
|
||||||
- uses: EndBug/add-and-commit@v8
|
- uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
message: 'Add the very useful text file'
|
message: 'Add the very useful text file'
|
||||||
add: '*.txt --force'
|
add: '*.txt --force'
|
||||||
@@ -357,6 +376,16 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
<tr>
|
<tr>
|
||||||
<td align="center"><a href="https://github.com/prince-chrismc"><img src="https://avatars.githubusercontent.com/u/16867443?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Mc</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=prince-chrismc" title="Documentation">📖</a></td>
|
<td align="center"><a href="https://github.com/prince-chrismc"><img src="https://avatars.githubusercontent.com/u/16867443?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Mc</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=prince-chrismc" title="Documentation">📖</a></td>
|
||||||
<td align="center"><a href="https://linkedin.com/in/namyalg"><img src="https://avatars.githubusercontent.com/u/53875297?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Namya LG</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=Namyalg" title="Documentation">📖</a></td>
|
<td align="center"><a href="https://linkedin.com/in/namyalg"><img src="https://avatars.githubusercontent.com/u/53875297?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Namya LG</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=Namyalg" title="Documentation">📖</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/sconix"><img src="https://avatars.githubusercontent.com/u/921515?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Janne Julkunen</b></sub></a><br /><a href="#ideas-sconix" title="Ideas, Planning, & Feedback">🤔</a></td>
|
||||||
|
<td align="center"><a href="https://joshcena.com"><img src="https://avatars.githubusercontent.com/u/55398995?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joshua Chen</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3AJosh-Cena" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center"><a href="http://akimon658.github.io"><img src="https://avatars.githubusercontent.com/u/81888693?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Akimo</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=Akimon658" title="Documentation">📖</a></td>
|
||||||
|
<td align="center"><a href="https://revolunet.com"><img src="https://avatars.githubusercontent.com/u/124937?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Julien Bouquillon</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=revolunet" title="Documentation">📖</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/AvivPeledTalon"><img src="https://avatars.githubusercontent.com/u/92471076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aviv Peled</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3AAvivPeledTalon" title="Bug reports">🐛</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="https://github.com/onedr0p"><img src="https://avatars.githubusercontent.com/u/213795?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Devin Buhl</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Aonedr0p" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center"><a href="https://erekspeed.com"><img src="https://avatars.githubusercontent.com/u/1176550?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Erek Speed</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Amelink14" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center"><a href="https://kachkaev.uk"><img src="https://avatars.githubusercontent.com/u/608862?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexander Kachkaev</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Akachkaev" title="Bug reports">🐛</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
12
action.yml
12
action.yml
@@ -29,6 +29,10 @@ inputs:
|
|||||||
description: How the action should fill missing author name or email.
|
description: How the action should fill missing author name or email.
|
||||||
required: false
|
required: false
|
||||||
default: 'github_actor'
|
default: 'github_actor'
|
||||||
|
fetch:
|
||||||
|
description: Arguments for the git fetch command (if 'false', the action won't fetch the repo)
|
||||||
|
required: false
|
||||||
|
default: --tags --force
|
||||||
message:
|
message:
|
||||||
description: The message for the commit
|
description: The message for the commit
|
||||||
required: false
|
required: false
|
||||||
@@ -52,6 +56,12 @@ inputs:
|
|||||||
tag:
|
tag:
|
||||||
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
|
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
|
||||||
required: false
|
required: false
|
||||||
|
tag_push:
|
||||||
|
description: Arguments for the git push --tags command (any additional argument will be added after --tags)
|
||||||
|
required: false
|
||||||
|
worktree:
|
||||||
|
description: Arguments for the git worktree commands, see the README for usage
|
||||||
|
required: false
|
||||||
|
|
||||||
# Input not required from the user
|
# Input not required from the user
|
||||||
github_token:
|
github_token:
|
||||||
@@ -70,6 +80,8 @@ outputs:
|
|||||||
description: Whether the action has pushed to the remote.
|
description: Whether the action has pushed to the remote.
|
||||||
tagged:
|
tagged:
|
||||||
description: Whether the action has created a tag.
|
description: Whether the action has created a tag.
|
||||||
|
tag_pushed:
|
||||||
|
description: Whether the action has pushed a tag.
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
|
|||||||
4
lib/index.js
generated
4
lib/index.js
generated
File diff suppressed because one or more lines are too long
663
package-lock.json
generated
663
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "add-and-commit",
|
"name": "add-and-commit",
|
||||||
"version": "8.0.2",
|
"version": "9.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Add & commit files from a path directly from GitHub Actions",
|
"description": "Add & commit files from a path directly from GitHub Actions",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/EndBug/add-and-commit#readme",
|
"homepage": "https://github.com/EndBug/add-and-commit#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.9.1",
|
||||||
"actions-toolkit": "github:EndBug/actions-toolkit#core-actions",
|
"actions-toolkit": "github:EndBug/actions-toolkit#core-actions",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"simple-git": "^2.27.0",
|
"simple-git": "^3.7.1",
|
||||||
"string-argv": "^0.3.1"
|
"string-argv": "^0.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -42,15 +42,15 @@
|
|||||||
"@types/node": "^12.12.54",
|
"@types/node": "^12.12.54",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||||
"@typescript-eslint/parser": "^4.33.0",
|
"@typescript-eslint/parser": "^4.33.0",
|
||||||
"@vercel/ncc": "^0.33.1",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"all-contributors-cli": "^6.20.0",
|
"all-contributors-cli": "^6.20.0",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"husky": "^7.0.4",
|
"husky": "^8.0.1",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.7.1",
|
||||||
"ts-node": "^10.4.0",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.8.2",
|
||||||
"yamljs": "^0.3.0"
|
"yamljs": "^0.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
44
src/io.ts
44
src/io.ts
@@ -10,6 +10,7 @@ interface InputTypes {
|
|||||||
committer_email: string
|
committer_email: string
|
||||||
cwd: string
|
cwd: string
|
||||||
default_author: 'github_actor' | 'user_info' | 'github_actions'
|
default_author: 'github_actor' | 'user_info' | 'github_actions'
|
||||||
|
fetch: string
|
||||||
message: string
|
message: string
|
||||||
new_branch: string | undefined
|
new_branch: string | undefined
|
||||||
pathspec_error_handling: 'ignore' | 'exitImmediately' | 'exitAtEnd'
|
pathspec_error_handling: 'ignore' | 'exitImmediately' | 'exitAtEnd'
|
||||||
@@ -17,6 +18,8 @@ interface InputTypes {
|
|||||||
push: string
|
push: string
|
||||||
remove: string | undefined
|
remove: string | undefined
|
||||||
tag: string | undefined
|
tag: string | undefined
|
||||||
|
tag_push: string | undefined
|
||||||
|
worktree: string | undefined
|
||||||
|
|
||||||
github_token: string | undefined
|
github_token: string | undefined
|
||||||
}
|
}
|
||||||
@@ -28,6 +31,7 @@ interface OutputTypes {
|
|||||||
commit_sha: string | undefined
|
commit_sha: string | undefined
|
||||||
pushed: 'true' | 'false'
|
pushed: 'true' | 'false'
|
||||||
tagged: 'true' | 'false'
|
tagged: 'true' | 'false'
|
||||||
|
tag_pushed: 'true' | 'false'
|
||||||
}
|
}
|
||||||
export type output = keyof OutputTypes
|
export type output = keyof OutputTypes
|
||||||
|
|
||||||
@@ -36,7 +40,8 @@ export const outputs: OutputTypes = {
|
|||||||
commit_long_sha: undefined,
|
commit_long_sha: undefined,
|
||||||
commit_sha: undefined,
|
commit_sha: undefined,
|
||||||
pushed: 'false',
|
pushed: 'false',
|
||||||
tagged: 'false'
|
tagged: 'false',
|
||||||
|
tag_pushed: 'false'
|
||||||
}
|
}
|
||||||
// Setup default output values
|
// Setup default output values
|
||||||
Object.entries(outputs).forEach(([name, value]) => core.setOutput(name, value))
|
Object.entries(outputs).forEach(([name, value]) => core.setOutput(name, value))
|
||||||
@@ -121,6 +126,20 @@ export async function checkInputs() {
|
|||||||
)
|
)
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region fetch
|
||||||
|
if (getInput('fetch')) {
|
||||||
|
let value: string | boolean
|
||||||
|
|
||||||
|
try {
|
||||||
|
value = getInput('fetch', true)
|
||||||
|
} catch {
|
||||||
|
value = getInput('fetch')
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(`Currrent fetch option: '${value}' (parsed as ${typeof value})`)
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region author_name, author_email
|
// #region author_name, author_email
|
||||||
let name, email
|
let name, email
|
||||||
switch (getInput('default_author')) {
|
switch (getInput('default_author')) {
|
||||||
@@ -225,6 +244,29 @@ export async function checkInputs() {
|
|||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
// #region worktree
|
||||||
|
if (getInput('worktree')) {
|
||||||
|
const parsed = parseInputArray(getInput('worktree') || '')
|
||||||
|
|
||||||
|
if (parsed.length == 1)
|
||||||
|
core.info(
|
||||||
|
"Worktree input parsed as single string, it will be used as if it's the path to the worktree."
|
||||||
|
)
|
||||||
|
else if (parsed.length == 2 || parsed.length == 3)
|
||||||
|
core.info(
|
||||||
|
'Worktree input parsed as [string, string, string], it will be used as follows:\n' +
|
||||||
|
'0: path to the worktree directory\n' +
|
||||||
|
'1: arguments for the git worktree add command (including the directory), defaults to the directory\n' +
|
||||||
|
'2: arguments for the git worktree remove command (including the directory), defaults to the directory'
|
||||||
|
)
|
||||||
|
else
|
||||||
|
core.setFailed(
|
||||||
|
`Worktree input parsed as an array of length ${parsed.length}, correct lenghts are 1, 2, and 3.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
// #region github_token
|
// #region github_token
|
||||||
if (!getInput('github_token'))
|
if (!getInput('github_token'))
|
||||||
core.warning(
|
core.warning(
|
||||||
|
|||||||
132
src/main.ts
132
src/main.ts
@@ -14,18 +14,40 @@ core.info(`Running in ${baseDir}`)
|
|||||||
await checkInputs()
|
await checkInputs()
|
||||||
|
|
||||||
core.startGroup('Internal logs')
|
core.startGroup('Internal logs')
|
||||||
|
|
||||||
|
let worktreeDir: string,
|
||||||
|
worktreeAdd: string,
|
||||||
|
worktreeRemove: string | undefined
|
||||||
|
if (getInput('worktree')) {
|
||||||
|
core.info('> Creating worktree...')
|
||||||
|
;[worktreeDir, worktreeAdd, worktreeRemove] = parseInputArray(
|
||||||
|
getInput('worktree') || ''
|
||||||
|
)
|
||||||
|
worktreeAdd = worktreeAdd || worktreeDir
|
||||||
|
worktreeRemove = worktreeRemove || worktreeDir
|
||||||
|
|
||||||
|
core.debug(`Running: git worktree add ${worktreeAdd}`)
|
||||||
|
await git
|
||||||
|
.raw('worktree', 'add', ...worktreeAdd.split(' '))
|
||||||
|
.then((data) => log(undefined, data))
|
||||||
|
|
||||||
|
core.info('> Changing working directory...')
|
||||||
|
await git.cwd(worktreeDir)
|
||||||
|
} else core.info('> Not creating a worktree.')
|
||||||
|
|
||||||
core.info('> Staging files...')
|
core.info('> Staging files...')
|
||||||
|
|
||||||
const peh = getInput('pathspec_error_handling')
|
const ignoreErrors =
|
||||||
|
getInput('pathspec_error_handling') == 'ignore' ? 'pathspec' : 'none'
|
||||||
|
|
||||||
if (getInput('add')) {
|
if (getInput('add')) {
|
||||||
core.info('> Adding files...')
|
core.info('> Adding files...')
|
||||||
await add(peh == 'ignore' ? 'pathspec' : 'none')
|
await add(ignoreErrors)
|
||||||
} else core.info('> No files to add.')
|
} else core.info('> No files to add.')
|
||||||
|
|
||||||
if (getInput('remove')) {
|
if (getInput('remove')) {
|
||||||
core.info('> Removing files...')
|
core.info('> Removing files...')
|
||||||
await remove(peh == 'ignore' ? 'pathspec' : 'none')
|
await remove(ignoreErrors)
|
||||||
} else core.info('> No files to remove.')
|
} else core.info('> No files to remove.')
|
||||||
|
|
||||||
core.info('> Checking for uncommitted changes in the git working tree...')
|
core.info('> Checking for uncommitted changes in the git working tree...')
|
||||||
@@ -54,10 +76,29 @@ core.info(`Running in ${baseDir}`)
|
|||||||
JSON.stringify((await git.listConfig()).all, null, 2)
|
JSON.stringify((await git.listConfig()).all, null, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
await git.fetch(['--tags', '--force'], log)
|
let fetchOption: string | boolean
|
||||||
|
try {
|
||||||
|
fetchOption = getInput('fetch', true)
|
||||||
|
} catch {
|
||||||
|
fetchOption = getInput('fetch')
|
||||||
|
}
|
||||||
|
if (fetchOption) {
|
||||||
|
core.info('> Fetching repo...')
|
||||||
|
await git.fetch(
|
||||||
|
matchGitArgs(fetchOption === true ? '' : fetchOption),
|
||||||
|
log
|
||||||
|
)
|
||||||
|
} else core.info('> Not fetching repo.')
|
||||||
|
|
||||||
const targetBranch = getInput('new_branch')
|
const targetBranch = getInput('new_branch')
|
||||||
if (targetBranch) {
|
if (targetBranch) {
|
||||||
|
core.info('> Checking-out branch...')
|
||||||
|
|
||||||
|
if (!fetchOption)
|
||||||
|
core.warning(
|
||||||
|
'Creating a new branch without fetching the repo first could result in an error when pushing to GitHub. Refer to the action README for more info about this topic.'
|
||||||
|
)
|
||||||
|
|
||||||
await git
|
await git
|
||||||
.checkout(targetBranch)
|
.checkout(targetBranch)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -76,26 +117,45 @@ core.info(`Running in ${baseDir}`)
|
|||||||
await git
|
await git
|
||||||
.fetch(undefined, log)
|
.fetch(undefined, log)
|
||||||
.pull(undefined, undefined, matchGitArgs(pullOption), log)
|
.pull(undefined, undefined, matchGitArgs(pullOption), log)
|
||||||
|
|
||||||
|
core.info('> Checking for conflicts...')
|
||||||
|
const status = await git.status(undefined, log)
|
||||||
|
|
||||||
|
if (!status.conflicted.length) {
|
||||||
|
core.info('> No conflicts found.')
|
||||||
|
core.info('> Re-staging files...')
|
||||||
|
if (getInput('add')) await add(ignoreErrors)
|
||||||
|
if (getInput('remove')) await remove(ignoreErrors)
|
||||||
|
} else
|
||||||
|
throw new Error(
|
||||||
|
`There are ${
|
||||||
|
status.conflicted.length
|
||||||
|
} conflicting files: ${status.conflicted.join(', ')}`
|
||||||
|
)
|
||||||
} else core.info('> Not pulling from repo.')
|
} else core.info('> Not pulling from repo.')
|
||||||
|
|
||||||
core.info('> Creating commit...')
|
core.info('> Creating commit...')
|
||||||
const commitData = await git
|
|
||||||
.commit(getInput('message'), matchGitArgs(getInput('commit') || ''))
|
|
||||||
.catch((err) => {
|
|
||||||
log(err)
|
|
||||||
})
|
|
||||||
if (commitData) {
|
|
||||||
log(undefined, commitData)
|
|
||||||
setOutput('committed', 'true')
|
|
||||||
setOutput('commit_sha', commitData.commit)
|
|
||||||
await git
|
await git
|
||||||
.revparse(commitData.commit)
|
.commit(getInput('message'), matchGitArgs(getInput('commit') || ''))
|
||||||
|
.then(async (data) => {
|
||||||
|
log(undefined, data)
|
||||||
|
setOutput('committed', 'true')
|
||||||
|
setOutput('commit_sha', data.commit)
|
||||||
|
await git
|
||||||
|
.revparse(data.commit)
|
||||||
.then((long_sha) => setOutput('commit_long_sha', long_sha))
|
.then((long_sha) => setOutput('commit_long_sha', long_sha))
|
||||||
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
|
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
|
||||||
}
|
})
|
||||||
|
.catch((err) => core.setFailed(err))
|
||||||
|
|
||||||
if (getInput('tag')) {
|
if (getInput('tag')) {
|
||||||
core.info('> Tagging commit...')
|
core.info('> Tagging commit...')
|
||||||
|
|
||||||
|
if (!fetchOption)
|
||||||
|
core.warning(
|
||||||
|
'Creating a tag without fetching the repo first could result in an error when pushing to GitHub. Refer to the action README for more info about this topic.'
|
||||||
|
)
|
||||||
|
|
||||||
await git
|
await git
|
||||||
.tag(matchGitArgs(getInput('tag') || ''), (err, data?) => {
|
.tag(matchGitArgs(getInput('tag') || ''), (err, data?) => {
|
||||||
if (data) setOutput('tagged', 'true')
|
if (data) setOutput('tagged', 'true')
|
||||||
@@ -148,30 +208,28 @@ core.info(`Running in ${baseDir}`)
|
|||||||
|
|
||||||
if (getInput('tag')) {
|
if (getInput('tag')) {
|
||||||
core.info('> Pushing tags to repo...')
|
core.info('> Pushing tags to repo...')
|
||||||
|
|
||||||
await git
|
await git
|
||||||
.pushTags('origin', undefined, (e, d?) => log(undefined, e || d))
|
.pushTags('origin', matchGitArgs(getInput('tag_push') || ''))
|
||||||
.catch(() => {
|
.then((data) => {
|
||||||
core.info(
|
setOutput('tag_pushed', 'true')
|
||||||
'> Tag push failed: deleting remote tag and re-pushing...'
|
return log(null, data)
|
||||||
)
|
|
||||||
return git
|
|
||||||
.push(
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
{
|
|
||||||
'--delete': null,
|
|
||||||
origin: null,
|
|
||||||
[matchGitArgs(getInput('tag') || '').filter(
|
|
||||||
(w) => !w.startsWith('-')
|
|
||||||
)[0]]: null
|
|
||||||
},
|
|
||||||
log
|
|
||||||
)
|
|
||||||
.pushTags('origin', undefined, log)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => core.setFailed(err))
|
||||||
} else core.info('> No tags to push.')
|
} else core.info('> No tags to push.')
|
||||||
} else core.info('> Not pushing anything.')
|
} else core.info('> Not pushing anything.')
|
||||||
|
|
||||||
|
if (worktreeRemove) {
|
||||||
|
core.info('> Switching back to previous working directory...')
|
||||||
|
await git.cwd(baseDir)
|
||||||
|
|
||||||
|
core.info('> Removing worktree...')
|
||||||
|
core.debug(`Running: git worktree remove ${worktreeRemove}`)
|
||||||
|
await git
|
||||||
|
.raw('worktree', 'remove', worktreeRemove.split(' '))
|
||||||
|
.then((data) => log(undefined, data))
|
||||||
|
} else core.info('> No worktree to remove.')
|
||||||
|
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
core.info('> Task completed.')
|
core.info('> Task completed.')
|
||||||
} else {
|
} else {
|
||||||
@@ -194,14 +252,12 @@ core.info(`Running in ${baseDir}`)
|
|||||||
core.setFailed(e)
|
core.setFailed(e)
|
||||||
})
|
})
|
||||||
|
|
||||||
async function add(
|
async function add(ignoreErrors: 'all' | 'pathspec' | 'none' = 'none') {
|
||||||
ignoreErrors: 'all' | 'pathspec' | 'none' = 'none'
|
|
||||||
): Promise<(void | Response<void>)[]> {
|
|
||||||
const input = getInput('add')
|
const input = getInput('add')
|
||||||
if (!input) return []
|
if (!input) return []
|
||||||
|
|
||||||
const parsed = parseInputArray(input)
|
const parsed = parseInputArray(input)
|
||||||
const res: (void | Response<void>)[] = []
|
const res: (string | void)[] = []
|
||||||
|
|
||||||
for (const args of parsed) {
|
for (const args of parsed) {
|
||||||
res.push(
|
res.push(
|
||||||
|
|||||||
Reference in New Issue
Block a user