From 94047e02332fcfce595faaad6aed96b0457889e4 Mon Sep 17 00:00:00 2001 From: Mak Date: Wed, 24 Jul 2024 17:31:06 +0100 Subject: [PATCH] more comments and remove help message on --clean --- .github/scripts/cmd/_help.py | 7 +++++++ .github/scripts/cmd/cmd.py | 7 +++++-- .github/workflows/cmd.yml | 7 +++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/scripts/cmd/_help.py b/.github/scripts/cmd/_help.py index eeedadcf97..8ad49dad84 100644 --- a/.github/scripts/cmd/_help.py +++ b/.github/scripts/cmd/_help.py @@ -1,5 +1,12 @@ import argparse +""" + +Custom help action for argparse, it prints the help message for the main parser and all subparsers. + +""" + + class _HelpAction(argparse._HelpAction): def __call__(self, parser, namespace, values, option_string=None): parser.print_help() diff --git a/.github/scripts/cmd/cmd.py b/.github/scripts/cmd/cmd.py index 940c225962..5ebf6dfd09 100755 --- a/.github/scripts/cmd/cmd.py +++ b/.github/scripts/cmd/cmd.py @@ -15,9 +15,12 @@ runtimeNames = list(map(lambda x: x['name'], runtimesMatrix)) common_args = { - '--continue-on-fail': {"action": "store_true", "help": "Won't exit(1) on failed command and continue with next steps"}, + '--continue-on-fail': {"action": "store_true", "help": "Won't exit(1) on failed command and continue with next " + "steps. Helpful when you want to push at least successful " + "pallets, and then run failed ones separately"}, '--quiet': {"action": "store_true", "help": "Won't print start/end/failed messages in Pull Request"}, - '--clean': {"action": "store_true", "help": "Clean up the previous bot's & author's comments in Pull Request which triggered /cmd"}, + '--clean': {"action": "store_true", "help": "Clean up the previous bot's & author's comments in Pull Request " + "which triggered /cmd"}, } parser = argparse.ArgumentParser(prog="/cmd ", description='A command runner for polkadot runtimes repo', add_help=False) diff --git a/.github/workflows/cmd.yml b/.github/workflows/cmd.yml index e04595945e..f06cf7fb63 100644 --- a/.github/workflows/cmd.yml +++ b/.github/workflows/cmd.yml @@ -10,6 +10,9 @@ permissions: # allow the action to comment on the PR pull-requests: write actions: read +env: + TAPLO_VERSION: '0.8.1' + jobs: acknowledge: if: ${{ startsWith(github.event.comment.body, '/cmd') }} @@ -58,7 +61,7 @@ jobs: if ( ${{ github.event.comment.id }} !== comment.id && ( - (comment.body.startsWith('Command') && comment.user.type === 'Bot') || + ((comment.body.startsWith('Command') || comment.body.startsWith('
Command')) && comment.user.type === 'Bot') || (comment.body.startsWith('/cmd') && comment.user.login === context.actor) ) ) { @@ -214,7 +217,7 @@ jobs: - name: Install dependencies for fmt if: startsWith(steps.get-pr-comment.outputs.group2, 'fmt') - run: cargo install taplo-cli --version 0.8.1 + run: cargo install taplo-cli --version ${{ env.TAPLO_VERSION }} - name: Setup Cache uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0