[7930077461] do-cmd #92
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: do-cmd | |
run-name: '[${{ inputs.id || github.run_id }}] do-cmd' | |
on: | |
workflow_dispatch: | |
inputs: | |
cmd: | |
description: what command to run | |
type: string | |
required: true | |
id: | |
description: 'an identifier for the workflow run (default is `github.run_id`)' | |
type: string | |
required: false | |
do-checkout-before: | |
description: whether to do a checkout of this repo before running command | |
type: boolean | |
required: false | |
default: false | |
do-make-target-before: | |
description: whether to run the "before" make target before running command | |
type: boolean | |
required: false | |
default: false | |
do-help: | |
description: whether to run the command with --help flag | |
type: boolean | |
required: false | |
default: false | |
do-version: | |
description: whether to run the command with --version flag | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
do-cmd: | |
if: '! (inputs.do-help || inputs.do-version)' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
if: inputs.do-checkout-before | |
- run: make before | |
if: inputs.do-make-target-before | |
- run: ${{ inputs.cmd }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.X_REPO_TOKEN }} | |
- run: | | |
title='The output' | |
echo "::[group]::$title" | |
echo 'Hello World!' | |
echo '::[endgroup]::' | |
do-help: | |
if: inputs.do-help | |
runs-on: ubuntu-latest | |
steps: | |
- run: ${{ inputs.cmd }} --help | |
do-version: | |
if: inputs.do-version | |
runs-on: ubuntu-latest | |
steps: | |
- run: ${{ inputs.cmd }} --version |