Skip to content

Commit 956a474

Browse files
Merge pull request #49 from stefanzweifel/feature/outputs
Feature: Add "changes_detected" output
2 parents cd0530a + f866b2a commit 956a474

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: git-auto-commit
2+
3+
on: push
4+
5+
jobs:
6+
git-auto-commit:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Use git-auto-commit-action
13+
id: "auto-commit-action"
14+
uses: ./
15+
16+
- name: "no changes detected"
17+
if: steps.auto-commit-action.outputs.changes_detected == false
18+
run: "echo \"No changes detected\""
19+
20+
- name: "changes detected"
21+
if: steps.auto-commit-action.outputs.changes_detected == true
22+
run: "echo \"Changes detected\""

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.0.0...HEAD)
88

9-
> TBD
9+
### Added
10+
- Add `changes_detected` output [#49](https://github.com/stefanzweifel/git-auto-commit-action/pull/49)
1011

1112
## [v4.0.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v3.0.0...v4.0.0) - 2020-02-24
1213

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ jobs:
103103

104104
Checkout [`action.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml) for a full list of supported inputs.
105105

106+
## Outputs
107+
You can use these outputs to trigger other Actions in your Workflow run based on the result of `git-auto-commit-action`.
108+
109+
- `changes_detected`: Returns either "true" or "false" if the repository was dirty and files have changed.
110+
106111
## Troubleshooting
107112

108113
### Can't push commit to repository

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ inputs:
3535
required: false
3636
default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
3737

38+
outputs:
39+
changes_detected:
40+
description: Value is "true", if the repository was dirty and file changes have been detected. Value is "false", if no changes have been detected.
41+
3842
runs:
3943
using: 'node12'
4044
main: 'index.js'

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ _main() {
77

88
if _git_is_dirty; then
99

10+
echo \"::set-output name=changes_detected::true\"
11+
1012
_setup_git
1113

1214
_switch_to_branch
@@ -17,6 +19,9 @@ _main() {
1719

1820
_push_to_github
1921
else
22+
23+
echo \"::set-output name=changes_detected::false\"
24+
2025
echo "Working tree clean. Nothing to commit."
2126
fi
2227
}

0 commit comments

Comments
 (0)