Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
darrynten committed Feb 20, 2020
1 parent a363d5b commit 68a67ee
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:git
FROM alpine/git

LABEL "repository"="http://github.com/UnicornGlobal/has-changes-action"
LABEL "homepage"="http://github.com/UnicornGlobal/has-changes-action"
Expand Down
50 changes: 46 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# GitHub action for checking if a repo has uncommitted changes
# Has Changes

This is useful for things like checking if you need to open a
pull request for changes that may be introduced through another
action.
GitHub action for checking if the repo is dirty (has uncommitted changes).

## Why?

This is useful for things like checking if you need to open a pull
request for any changes that may be introduced through another action.

## How?

Add a step in a job after any steps whose code changes you want to check.

You will then be able to check the status in subsequent steps.

You do this by checking if `changed` is equal to `1`.

The value will be 0 if no code has been changed by any previous steps.

## Example

```yaml
name: Has Changes
jobs:
has-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Make changes
run: touch change.temp
# This step will evaluate the repo status and report the change
- name: Check if there are changes
id: changes
uses: UnicornGlobal/[email protected]
# You can now access a variable indicating if there have been changes
- name: Process changes
if: steps.changes.outputs.changed == 1
run: echo "Changes exist"
```
The example shows that adding a step to check the status will expose the
status on the `${{ steps.changes.outputs.changed }}` variable.

The `steps.changes` is defined by the `id: changes`. If you change the id
value then the step name must change too (as it references the id).

0 comments on commit 68a67ee

Please sign in to comment.