Skip to content

Command FMT

Command FMT #5

Workflow file for this run

name: Command-FMT
on:
workflow_dispatch:
inputs:
pr:
description: Number of the Pull Request
required: true
jobs:
cmd-fmt:
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
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
- 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: 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>."
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 }}