diff --git a/.github/workflows/command-fmt.yml b/.github/workflows/command-fmt.yml index 5df477a353a7..b9c6d49545ed 100644 --- a/.github/workflows/command-fmt.yml +++ b/.github/workflows/command-fmt.yml @@ -1,4 +1,4 @@ -name: Command-FMT +name: Command FMT on: workflow_dispatch: @@ -7,38 +7,30 @@ 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. @@ -46,11 +38,16 @@ jobs: taplo format --config .config/taplo.toml - name: Report failure if: ${{ failure() }} - run: gh pr comment ${{ inputs.pr }} --body "Run for fmt failed. See logs here." + run: gh pr comment ${{ inputs.pr }} --body "## Command failed ❌\n\nRun by @${{ github.actor }} for ${{ github.workflow }} failed. See logs here." 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 ${{ github.workflow }} completed 🎉. See logs here." + env: + RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/command-sync.yml b/.github/workflows/command-sync.yml index e6a248bcbd6a..c1bc5150d2ac 100644 --- a/.github/workflows/command-sync.yml +++ b/.github/workflows/command-sync.yml @@ -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 ${{ github.workflow }} failed. See logs here." + run: gh pr comment ${{ inputs.pr }} --body "## Command failed ❌\n\nRun by @${{ github.actor }} for ${{ github.workflow }} failed. See logs here." 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 ${{ github.workflow }} completed 🎉. See logs here." + env: + RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/command-update-ui.yml b/.github/workflows/command-update-ui.yml index 8608215e76ff..694383437c0b 100644 --- a/.github/workflows/command-update-ui.yml +++ b/.github/workflows/command-update-ui.yml @@ -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 ${{ github.workflow }} failed. See logs here." + run: gh pr comment ${{ inputs.pr }} --body "## Command failed ❌\n\nRun by @${{ github.actor }} for ${{ github.workflow }} failed. See logs here." 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 ${{ github.workflow }} completed 🎉. See logs here." + env: + RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_TOKEN: ${{ github.token }}