This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
run commands on comments #29
Workflow file for this run
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: Command-Action | |
on: | |
pull_request: | |
issue_comment: | |
types: [created] | |
jobs: | |
cmd-check: | |
runs-on: ubuntu-latest | |
outputs: | |
commands: ${{ steps.cmd.outputs.commands }} | |
branch: ${{ steps.branch.outputs.branch }} | |
name: Bot | |
steps: | |
- uses: actions/[email protected] | |
# Switch to the PR branch if it's triggered by a comment | |
- run: gh pr checkout ${{ github.event.issue.number || github.event.pull_request.number }} | |
if: ${{ github.event.issue.pull_request }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- uses: paritytech/cmd-action@main | |
id: cmd | |
with: | |
commands-directory: '.github/scripts' | |
- name: Export branch name | |
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT" | |
id: branch | |
cmd-run: | |
needs: [cmd-check] | |
if: ${{ github.event.issue.pull_request }} | |
continue-on-error: true | |
# We set the current machine here (to differ between ours and generic ones) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
command: ${{ fromJson(needs.cmd-check.outputs.commands) }} | |
name: Run command | |
steps: | |
- uses: paritytech/cmd-action/run@main | |
with: | |
branch: ${{ needs.cmd-check.outputs.branch }} | |
command: ${{ matrix.command }} |