Skip to content

Commit fb7ae44

Browse files
committed
feat: add post-checkout-command input to action
1 parent a4ebd24 commit fb7ae44

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ GitHub Action for Python (Poetry, pytest with coverage and linters with prek/pr
99
Name | Description | Default | Required
1010
-|:-|-|-
1111
checkout| Set `1` to run [checkout](https://github.com/marketplace/actions/checkout). | `1` | No
12+
post-checkout-command| Optional shell command(s) to run right after checkout (only when `checkout` is `1`). Multiple commands can be passed as a multi-line string (e.g. with YAML `\|`). The value is interpolated into a `bash` script, so pass only trusted content. | `''` | No
1213
set-python| Set `1` to run [setup-pytyon](https://github.com/marketplace/actions/setup-python). | `1` | No
1314
python-version| `python-version` for setup-python. | `3.12` | No
1415
setup-type| Python environment setup type (`poetry` `uv`, or `pip`.). | `poetry` | No

action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ inputs:
1010
description: 'Set 1 to run checkout.'
1111
default: '1'
1212
required: true
13+
post-checkout-command:
14+
description: 'Optional shell command(s) to run right after checkout. Multiple commands can be passed as a multi-line string.'
15+
default: ''
16+
required: false
1317
setup-python:
1418
description: 'Set 1 to run setup-python.'
1519
default: '1'
@@ -126,6 +130,13 @@ runs:
126130
with:
127131
persist-credentials: false
128132
fetch-depth: 0
133+
- name: Run post-checkout command
134+
if: ${{ inputs.checkout == '1' && inputs.post-checkout-command != '' }}
135+
run: |
136+
echo "::group::post-checkout command"
137+
${{ inputs.post-checkout-command }}
138+
echo "::endgroup::"
139+
shell: bash
129140
- name: Install poetry
130141
if: ${{ inputs.setup-type == 'poetry' }}
131142
run: |

0 commit comments

Comments
 (0)