Skip to content

Commit 4058dff

Browse files
committed
testing
1 parent b850756 commit 4058dff

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

‎.github/workflows/monorepo-split-plan.yml‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ on:
1818
- '.github/workflows/monorepo-split-plan.yml'
1919
- 'src/SonsOfPHP/**/composer.json'
2020
- 'src/**'
21+
workflow_dispatch:
22+
inputs:
23+
base:
24+
description: 'Base git ref for changed-package replay'
25+
required: false
26+
head:
27+
description: 'Head git ref to check out and publish'
28+
required: true
29+
default: 'main'
30+
tag:
31+
description: 'Optional release tag to publish instead of a branch range'
32+
required: false
33+
publish:
34+
description: 'Actually push split refs instead of calculating only'
35+
required: true
36+
type: boolean
37+
default: false
2138

2239
permissions:
2340
contents: read
@@ -35,6 +52,7 @@ jobs:
3552
with:
3653
fetch-depth: 0
3754
persist-credentials: false
55+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.head || github.ref }}
3856
- uses: shivammathur/setup-php@v2
3957
with:
4058
php-version: '8.3'
@@ -63,14 +81,14 @@ jobs:
6381
splitsh-lite --help
6482
- uses: actions/create-github-app-token@v3
6583
id: app-token
66-
if: github.event_name == 'push'
84+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish)
6785
with:
6886
client-id: ${{ secrets.MONOREPO_SPLIT_APP_CLIENT_ID }}
6987
private-key: ${{ secrets.MONOREPO_SPLIT_APP_PRIVATE_KEY }}
7088
owner: ${{ github.repository_owner }}
7189
permission-contents: write
7290
- name: Configure read-only repo token auth
73-
if: github.event_name == 'push'
91+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish)
7492
env:
7593
MONOREPO_SPLIT_TOKEN: ${{ steps.app-token.outputs.token }}
7694
run: |
@@ -101,3 +119,29 @@ jobs:
101119
--tag='${{ github.ref_name }}' \
102120
--origin='${{ github.ref }}' \
103121
--publish
122+
- name: Run manual split replay
123+
if: github.event_name == 'workflow_dispatch'
124+
env:
125+
BASE_REF: ${{ inputs.base }}
126+
HEAD_REF: ${{ inputs.head }}
127+
TAG_NAME: ${{ inputs.tag }}
128+
PUBLISH_SPLITS: ${{ inputs.publish }}
129+
run: |
130+
if [ -n "$TAG_NAME" ]; then
131+
command=(php .github/scripts/monorepo-split-plan.php --tag="$TAG_NAME" --origin="refs/tags/$TAG_NAME")
132+
else
133+
if [ -z "$BASE_REF" ]; then
134+
echo "::error::Manual branch replay requires the base input."
135+
exit 1
136+
fi
137+
138+
command=(php .github/scripts/monorepo-split-plan.php --base="$BASE_REF" --head="$HEAD_REF" --origin=HEAD)
139+
fi
140+
141+
if [ "$PUBLISH_SPLITS" = "true" ]; then
142+
command+=(--publish)
143+
else
144+
command+=(--calculate-splits)
145+
fi
146+
147+
"${command[@]}"

0 commit comments

Comments
 (0)