/run-and-post-run

🚀 A simple GitHub action that allows you to execute commands on place and in post-run, once a workflow job has ended.

Primary LanguageJavaScriptMIT LicenseMIT

Logo

Run and post run Action

Release version Build Status License

A simple GitHub action that allows you to execute commands on place and in post-run, once a workflow job has ended.

Linked GitHub issue.

Usage

jobs:
  run-some-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run this action
        uses: gacts/run-and-post-run@v1
        with:
          run: echo "First"
              "(can be multiline)"
          post: |
            echo "First post"
            echo "(can run multiply commands)"
            ls -la /tmp \
              /bin /opt

      - name: Post command only
        uses: gacts/run-and-post-run@v1
        with:
          post: echo "Second post"

This above configuration will produce the following:

CI output example

More examples can be found in the tests.

Customizing

Inputs

The following inputs can be used as step.with keys:

Name Type Default Required Description
run string or list no A commands that needs to be run in place
post string or list yes A commands that needs to be run once a workflow job has ended
working-directory string no A working directory from which the command needs to be run
shell string bash no A shell to use for executing run commands
post-shell string no A shell to use for executing post commands. Defaults to value of shell

Releasing

To release a new version:

  • Build the action distribution (make build or npm run build).
  • Commit and push changes (including dist directory changes - this is important) to the master|main branch.
  • Publish the new release using the repo releases page (the git tag should follow the vX.Y.Z format).

Major and minor git tags (v1 and v1.2 if you publish a v1.2.Z release) will be updated automatically.

Tip

Use Dependabot to keep this action updated in your repository.

Support

Issues Pull Requests

If you find any errors in the action, please create an issue in this repository.

License

This is open-source software licensed under the MIT License.