Skip to content
alert-circle

GitHub Action

Check uncommitted changes

v1.0.1 Latest version

Check uncommitted changes

alert-circle

Check uncommitted changes

Checks if a git repository has uncommitted changes

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Check uncommitted changes

uses: mskri/[email protected]

Learn more about this action in mskri/check-uncommitted-changes-action

Choose a version

Check uncommitted changes action

A GitHub action for checking if repository has uncommitted changes.

Outputs

changes

Changes outputted by git status --porcelain.

Example usage

name: Check uncommitted changes
jobs:
  check-uncommitted-changes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
      - name: Make uncommitted changes by creating empty file
        run: touch uncommitted.tmp
      - name: Check for uncommitted changes
        id: check-changes
        uses: mskri/[email protected]
      - name: Evaluate if there are changes
        if: steps.check-changes.outputs.outcome == failure()
        run: echo "There are uncommitted changes"

Check uncommitted changes and print them out

name: Check uncommitted changes and print them out
jobs:
  check-uncommitted-changes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
      - name: Make uncommitted changes by creating empty file
        run: touch uncommitted.tmp
      - name: Check for uncommitted changes
        id: check-changes
        uses: mskri/[email protected]
      - name: Print uncommitted changes
        if: steps.check-changes.outputs.changes != ''
        run: echo "There are uncommitted changes"

Note: You can change the id of the step but remember to change the referencing id on the subsequent step(s).

Inspired by

https://github.com/marketplace/actions/has-changes