Skip to content

Instantly share code, notes, and snippets.

@somidad
Last active September 2, 2024 17:55
Show Gist options
  • Save somidad/3ce6e8a7b7d77ac8fa7fad583003d6f5 to your computer and use it in GitHub Desktop.
Save somidad/3ce6e8a7b7d77ac8fa7fad583003d6f5 to your computer and use it in GitHub Desktop.
GitHub Workflow to check any change on git repository and do something if any
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
- name: Check if there is any change
id: get_changes
# deprecated. see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
#run: echo "::set-output name=changed::$(git status --porcelain | wc -l)"
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
- name: Do something if there is any change
if: steps.get_changes.outputs.changed != 0
run: do something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment