Skip to content

Commit ac398ce

Browse files
committed
Allow specification of dry_run and debug in CI
You can now easily set the action to debug and dry_run mode in the CI by specifying the relevant inputs.
1 parent 8517fa6 commit ac398ce

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ jobs:
100100
| pr_title | Title of the Pull Request | no¹ |
101101
| pr_source | Source branch for the Pull Request | no¹ |
102102
| pull_request_payload | PR payload in JSON format² | no³ |
103+
| debug | set to "true" to turn on debug logging | no |
104+
| dry_run | set to "true" to not send the webhook request | no |
103105

104106
1) The Action will determine whether to send an embed tailored towards a Pull Request Check Run or towards a general workflow run based on the presence of non-null values for the four pull request arguments. This means that you either have to provide **all** of them or **none** of them.
105107

action.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ inputs:
6363
description: 'Pull Request in jSON payload form'
6464
required: false
6565

66+
debug:
67+
description: 'Pull Request in jSON payload form'
68+
required: false
69+
default: 'false'
70+
71+
dry_run:
72+
description: 'Pull Request in jSON payload form'
73+
required: false
74+
default: 'false'
75+
6676
runs:
6777
using: 'docker'
6878
image: 'Dockerfile'
@@ -82,6 +92,9 @@ runs:
8292
- ${{ inputs.pr_number }}
8393
- ${{ inputs.pr_title }}
8494
- ${{ inputs.pr_source }}
95+
- ${{ inputs.pull_request_payload }}
96+
- ${{ inputs.debug }}
97+
- ${{ inputs.dry_run }}
8598

8699
branding:
87100
icon: 'check-circle'

github_status_embed/__main__.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,11 @@
4545
for argument, configuration in action_specs["inputs"].items():
4646
parser.add_argument(argument, help=configuration["description"])
4747

48-
parser.add_argument(
49-
"--debug",
50-
help="enable debug logging",
51-
action="store_true",
52-
dest="debug",
53-
)
54-
parser.add_argument(
55-
"--dry-run",
56-
help="do not send webhook request",
57-
action="store_true",
58-
dest="dry_run"
59-
)
60-
6148

6249
if __name__ == "__main__":
6350
arguments = vars(parser.parse_args())
64-
debug = arguments.pop('debug')
65-
dry_run = arguments.pop('dry_run')
51+
debug = arguments.pop('debug') not in ('', '0', 'false')
52+
dry_run = arguments.pop('dry_run') not in ('', '0', 'false')
6653

6754
# Set up logging and make sure to mask the webhook_token in log records
6855
level = logging.DEBUG if debug else logging.WARNING

0 commit comments

Comments
 (0)