Test reusable workflows #68
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.command.outputs.commands }} | |
branch: ${{ steps.command.outputs.branch }} | |
name: Bot | |
steps: | |
- run: echo "data is $DATA" | |
env: | |
DATA: ${{ toJson(github.event.issue) }} | |
- uses: paritytech/cmd-action/check@test | |
id: command | |
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: | |
- name: Generate token | |
id: generate_token | |
uses: actions/[email protected] | |
with: | |
app-id: ${{ secrets.CMD_APP_ID }} | |
private-key: ${{ secrets.CMD_APP_KEY }} | |
- uses: paritytech/cmd-action/run@test | |
with: | |
branch: ${{ needs.cmd-check.outputs.branch }} | |
command: ${{ matrix.command.command }} | |
name: ${{ matrix.command.name }} | |
pr-number: ${{ github.event.issue.number || github.event.pull_request.number }} | |
token: ${{ steps.generate_token.outputs.token }} | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: cmd-action - changes | |
branch: ${{ needs.cmd-check.outputs.branch }} | |
conclude: | |
runs-on: ubuntu-latest | |
name: Checks passed | |
needs: [cmd-run] # It will only run if all the runs were completed | |
steps: | |
- name: Report Success | |
shell: bash | |
run: gh pr comment $NUMBER --repo ${{ github.repository }} --body "Completed action run. See logs <a href=\"$RUN\">here</a>." | |
env: | |
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
GH_TOKEN: ${{ github.token }} | |
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }} |