Skip to content

Commit

Permalink
added correct error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Jun 10, 2024
1 parent c2f2adb commit c1a0666
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
55 changes: 26 additions & 29 deletions .github/workflows/command-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Command-FMT
name: Command FMT

on:
workflow_dispatch:
Expand All @@ -7,50 +7,47 @@ on:
description: Number of the Pull Request
required: true


jobs:
set-image:
runs-on: ubuntu-latest
outputs:
IMAGE: ${{ steps.set_image.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: set_image
run: cat .github/env >> $GITHUB_OUTPUT
cmd-fmt:
needs: [set-image]
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240109
ports:
- 80
volumes:
- my_docker_volume:/volume_mount
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
# - name: Check branch name
# if: startsWith(github.ref, 'master/')
# run: echo "::error ::'master' is an invalid branch. Select your PR's branch"
- name: Install gh cli
run: |
(type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
&& mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y
git config --global --add safe.directory '*'
- name: Download repo
uses: actions/checkout@v4
- run: gh pr checkout ${{ inputs.pr }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Export branch name
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
id: branch
- name: Install gh cli
id: gh
uses: ./.github/actions/set-up-gh
with:
pr-number: ${{ inputs.pr }}
GH_TOKEN: ${{ github.token }}
- name: Run FMT
run: |
# format toml.
# since paritytech/ci-unified:bullseye-1.73.0-2023-11-01-v20231204 includes taplo-cli
taplo format --config .config/taplo.toml
- name: Report failure
if: ${{ failure() }}
run: gh pr comment ${{ inputs.pr }} --body "Run for <code>fmt</code> failed. See logs <a href=\"$RUN\">here</a>."
run: gh pr comment ${{ inputs.pr }} --body "## Command failed ❌\n\nRun by @${{ github.actor }} for <code>${{ github.workflow }}</code> failed. See logs <a href=\"$RUN\">here</a>."
env:
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: cmd-action - changes
branch: ${{ steps.branch.outputs.branch }}
commit_message: cmd-action - ${{ github.workflow }}
branch: ${{ steps.gh.outputs.branch }}
- name: Report succeed
run: gh pr comment ${{ inputs.pr }} --body "## Action completed 🎉🎉\n\nRun by @${{ github.actor }} for <code>${{ github.workflow }}</code> completed 🎉. See logs <a href=\"$RUN\">here</a>."
env:
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}
9 changes: 7 additions & 2 deletions .github/workflows/command-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ jobs:
"./scripts/sync.sh" --chain "${{ inputs.chain }}" --type "${{ inputs.sync-type }}"
- name: Report failure
if: ${{ failure() }}
run: gh pr comment ${{ inputs.pr }} --body "Run by @${{ github.actor }} for <code>${{ github.workflow }}</code> failed. See logs <a href=\"$RUN\">here</a>."
run: gh pr comment ${{ inputs.pr }} --body "## Command failed ❌\n\nRun by @${{ github.actor }} for <code>${{ github.workflow }}</code> failed. See logs <a href=\"$RUN\">here</a>."
env:
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: cmd-action - changes
commit_message: cmd-action - ${{ github.workflow }}
branch: ${{ steps.gh.outputs.branch }}
- name: Report succeed
run: gh pr comment ${{ inputs.pr }} --body "## Action completed 🎉🎉\n\nRun by @${{ github.actor }} for <code>${{ github.workflow }}</code> completed 🎉. See logs <a href=\"$RUN\">here</a>."
env:
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}
9 changes: 7 additions & 2 deletions .github/workflows/command-update-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ jobs:
"./scripts/update-ui-tests.sh" "${{ inputs.rust-version }}"
- name: Report failure
if: ${{ failure() }}
run: gh pr comment ${{ inputs.pr }} --body "Run by @${{ github.actor }} for <code>${{ github.workflow }}</code> failed. See logs <a href=\"$RUN\">here</a>."
run: gh pr comment ${{ inputs.pr }} --body "## Command failed ❌\n\nRun by @${{ github.actor }} for <code>${{ github.workflow }}</code> failed. See logs <a href=\"$RUN\">here</a>."
env:
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: cmd-action - changes
commit_message: cmd-action - ${{ github.workflow }}
branch: ${{ steps.gh.outputs.branch }}
- name: Report succeed
run: gh pr comment ${{ inputs.pr }} --body "## Action completed 🎉🎉\n\nRun by @${{ github.actor }} for <code>${{ github.workflow }}</code> completed 🎉. See logs <a href=\"$RUN\">here</a>."
env:
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}

0 comments on commit c1a0666

Please sign in to comment.