s0 / git-publish-subdir-action

GitHub Action to push a subdirectory as a branch to any git repo (e.g. for GitHub Pages)
https://github.com/marketplace/actions/push-git-subdirectory-as-branch
MIT License
208 stars 36 forks source link

Output deployment status #92

Open wopian opened 1 year ago

wopian commented 1 year ago

I'm using this action to deploy built files to a branch, which works great.

I've setup the action to use SKIP_EMPTY_COMMITS, however I'm unable to use this to its full effect of reducing unwanted noise.

As the action passes without outputting anything, I cannot skip sending a "restart to pull changes" command to production services.

It would be incredibly useful to have an output that describes the state when the action passess successfully, such as:

state: 'pushed' | 'skipped'

E.g this example that would only run the some/other-action action if this action outputted a pushed state:

jobs:
  deploy:
  ...
  - uses: s0/git-publish-subdir-action@develop
    id: publish # sets custom id for step to reuse its outputs
  - uses: some/other-action@develop
    if: success() && steps.publish.outputs.state == 'pushed' # only gets run if there's "new" changes

Documentation on using Action outputs: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions?tool=bash#about-workflow-commands