Merge pull request #49 from stefanzweifel/feature/outputs
Feature: Add "changes_detected" output
This commit is contained in:
commit
956a47433b
22
.github/workflows/git-auto-commit.yml
vendored
Normal file
22
.github/workflows/git-auto-commit.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: git-auto-commit
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
git-auto-commit:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use git-auto-commit-action
|
||||
id: "auto-commit-action"
|
||||
uses: ./
|
||||
|
||||
- name: "no changes detected"
|
||||
if: steps.auto-commit-action.outputs.changes_detected == false
|
||||
run: "echo \"No changes detected\""
|
||||
|
||||
- name: "changes detected"
|
||||
if: steps.auto-commit-action.outputs.changes_detected == true
|
||||
run: "echo \"Changes detected\""
|
@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.0.0...HEAD)
|
||||
|
||||
> TBD
|
||||
### Added
|
||||
- Add `changes_detected` output [#49](https://github.com/stefanzweifel/git-auto-commit-action/pull/49)
|
||||
|
||||
## [v4.0.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v3.0.0...v4.0.0) - 2020-02-24
|
||||
|
||||
|
@ -103,6 +103,11 @@ jobs:
|
||||
|
||||
Checkout [`action.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml) for a full list of supported inputs.
|
||||
|
||||
## Outputs
|
||||
You can use these outputs to trigger other Actions in your Workflow run based on the result of `git-auto-commit-action`.
|
||||
|
||||
- `changes_detected`: Returns either "true" or "false" if the repository was dirty and files have changed.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Can't push commit to repository
|
||||
|
@ -35,6 +35,10 @@ inputs:
|
||||
required: false
|
||||
default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
|
||||
outputs:
|
||||
changes_detected:
|
||||
description: Value is "true", if the repository was dirty and file changes have been detected. Value is "false", if no changes have been detected.
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
||||
|
@ -7,6 +7,8 @@ _main() {
|
||||
|
||||
if _git_is_dirty; then
|
||||
|
||||
echo \"::set-output name=changes_detected::true\"
|
||||
|
||||
_setup_git
|
||||
|
||||
_switch_to_branch
|
||||
@ -17,6 +19,9 @@ _main() {
|
||||
|
||||
_push_to_github
|
||||
else
|
||||
|
||||
echo \"::set-output name=changes_detected::false\"
|
||||
|
||||
echo "Working tree clean. Nothing to commit."
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user