Skip to content

Commit

Permalink
more comments and remove help message on --clean
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax committed Jul 24, 2024
1 parent 01d23c9 commit 94047e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .github/scripts/cmd/_help.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
7 changes: 5 additions & 2 deletions .github/scripts/cmd/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down Expand Up @@ -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('<details><summary>Command')) && comment.user.type === 'Bot') ||
(comment.body.startsWith('/cmd') && comment.user.login === context.actor)
)
) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 94047e0

Please sign in to comment.