Merge pull request #49 from stefanzweifel/feature/outputs

Feature: Add "changes_detected" output
This commit is contained in:
Stefan Zweifel 2020-03-04 20:44:32 +01:00 committed by GitHub
commit 956a47433b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 1 deletions

22
.github/workflows/git-auto-commit.yml vendored Normal file
View 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\""

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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
}