Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unicornglobal/has-changes-action
GitHub action to check for uncommitted code changes
https://github.com/unicornglobal/has-changes-action
actions docker workflows
Last synced: 4 days ago
JSON representation
GitHub action to check for uncommitted code changes
- Host: GitHub
- URL: https://github.com/unicornglobal/has-changes-action
- Owner: UnicornGlobal
- License: mit
- Created: 2020-02-20T08:40:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-24T12:11:54.000Z (almost 2 years ago)
- Last Synced: 2024-11-02T17:36:28.122Z (12 days ago)
- Topics: actions, docker, workflows
- Language: Dockerfile
- Homepage:
- Size: 10.7 KB
- Stars: 32
- Watchers: 2
- Forks: 13
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Has Changes
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).