Skip to content

Commit 7160512

Browse files
committed
Rework issue-bot so that it does not output the entire matrix to GITHUB_OUTPUT
1 parent 7cb0ec7 commit 7160512

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

.github/workflows/issue-bot.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: "ubuntu-latest"
2929

3030
outputs:
31-
matrix: ${{ steps.download-data.outputs.matrix }}
31+
matrix: ${{ steps.shards.outputs.shards }}
3232

3333
steps:
3434
- name: "Checkout"
@@ -55,11 +55,15 @@ jobs:
5555
5656
- name: "Download data"
5757
working-directory: "issue-bot"
58-
id: download-data
5958
env:
6059
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
61-
run: echo "matrix=$(./console.php download)" >> $GITHUB_OUTPUT
60+
run: ./console.php download > matrix.json
6261

62+
- name: "Output shards"
63+
id: shards
64+
working-directory: "issue-bot"
65+
run: |
66+
echo "shards=$(jq -c '{include: [range(length) | {shard: .}]}' matrix.json)" >> $GITHUB_OUTPUT
6367
6468
- uses: actions/upload-artifact@v4
6569
with:
@@ -71,6 +75,11 @@ jobs:
7175
name: issue-cache
7276
path: issue-bot/tmp/issueCache.tmp
7377

78+
- uses: actions/upload-artifact@v4
79+
with:
80+
name: matrix
81+
path: issue-bot/matrix.json
82+
7483
analyse:
7584
name: "Analyse"
7685
needs: download
@@ -109,15 +118,32 @@ jobs:
109118
attempt_limit: 5
110119
attempt_delay: 1000
111120

121+
- uses: Wandalen/[email protected]
122+
with:
123+
action: actions/download-artifact@v4
124+
with: |
125+
name: matrix
126+
path: issue-bot
127+
attempt_limit: 5
128+
attempt_delay: 1000
129+
130+
- name: "Extract shard"
131+
working-directory: "issue-bot"
132+
id: chunk
133+
run: |
134+
echo "phpVersion=$(jq -r '.[${{ matrix.shard }}].phpVersion' matrix.json)" >> "$GITHUB_OUTPUT"
135+
echo "playgroundExamples=$(jq -r '.[${{ matrix.shard }}].playgroundExamples' matrix.json)" >> "$GITHUB_OUTPUT"
136+
echo "chunkNumber=$(jq -r '.[${{ matrix.shard }}].chunkNumber' matrix.json)" >> "$GITHUB_OUTPUT"
137+
112138
- name: "Run PHPStan"
113139
working-directory: "issue-bot"
114140
timeout-minutes: 5
115-
run: ./console.php run ${{ matrix.phpVersion }} ${{ matrix.playgroundExamples }}
141+
run: ./console.php run ${{ steps.chunk.outputs.phpVersion }} ${{ steps.chunk.outputs.playgroundExamples }}
116142

117143
- uses: actions/upload-artifact@v4
118144
with:
119-
name: results-${{ matrix.phpVersion }}-${{ matrix.chunkNumber }}
120-
path: issue-bot/tmp/results-${{ matrix.phpVersion }}-*.tmp
145+
name: results-${{ steps.chunk.outputs.phpVersion }}-${{ steps.chunk.outputs.chunkNumber }}
146+
path: issue-bot/tmp/results-${{ steps.chunk.outputs.phpVersion }}-*.tmp
121147

122148
evaluate:
123149
name: "Evaluate results"

issue-bot/src/Console/DownloadCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
141141
}
142142
}
143143

144-
$output->writeln(Json::encode(['include' => $matrix]));
144+
$output->writeln(Json::encode($matrix));
145145

146146
return 0;
147147
}

0 commit comments

Comments
 (0)