Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions .github/workflows/issue-bot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Issue bot"

Check notice on line 3 in .github/workflows/issue-bot.yml

View workflow job for this annotation

GitHub Actions / Evaluate results

Issue bot detected open issues which are affected by this pull request - see https://github.com/phpstan/phpstan-src/actions/runs/18996986581

on:
workflow_dispatch:
Expand Down Expand Up @@ -28,7 +28,7 @@
runs-on: "ubuntu-latest"

outputs:
matrix: ${{ steps.download-data.outputs.matrix }}
matrix: ${{ steps.shards.outputs.shards }}

steps:
- name: "Checkout"
Expand All @@ -55,11 +55,15 @@

- name: "Download data"
working-directory: "issue-bot"
id: download-data
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: echo "matrix=$(./console.php download)" >> $GITHUB_OUTPUT
run: ./console.php download > matrix.json

- name: "Output shards"
id: shards
working-directory: "issue-bot"
run: |
echo "shards=$(jq -c '{include: [range(length) | {shard: .}]}' matrix.json)" >> $GITHUB_OUTPUT

- uses: actions/upload-artifact@v4
with:
Expand All @@ -71,6 +75,11 @@
name: issue-cache
path: issue-bot/tmp/issueCache.tmp

- uses: actions/upload-artifact@v4
with:
name: matrix
path: issue-bot/matrix.json

analyse:
name: "Analyse"
needs: download
Expand Down Expand Up @@ -109,15 +118,32 @@
attempt_limit: 5
attempt_delay: 1000

- uses: Wandalen/wretry.action@v3.8.0
with:
action: actions/download-artifact@v4
with: |
name: matrix
path: issue-bot
attempt_limit: 5
attempt_delay: 1000

- name: "Extract shard"
working-directory: "issue-bot"
id: chunk
run: |
echo "phpVersion=$(jq -r '.[${{ matrix.shard }}].phpVersion' matrix.json)" >> "$GITHUB_OUTPUT"
echo "playgroundExamples=$(jq -r '.[${{ matrix.shard }}].playgroundExamples' matrix.json)" >> "$GITHUB_OUTPUT"
echo "chunkNumber=$(jq -r '.[${{ matrix.shard }}].chunkNumber' matrix.json)" >> "$GITHUB_OUTPUT"

- name: "Run PHPStan"
working-directory: "issue-bot"
timeout-minutes: 5
run: ./console.php run ${{ matrix.phpVersion }} ${{ matrix.playgroundExamples }}
run: ./console.php run ${{ steps.chunk.outputs.phpVersion }} ${{ steps.chunk.outputs.playgroundExamples }}

- uses: actions/upload-artifact@v4
with:
name: results-${{ matrix.phpVersion }}-${{ matrix.chunkNumber }}
path: issue-bot/tmp/results-${{ matrix.phpVersion }}-*.tmp
name: results-${{ steps.chunk.outputs.phpVersion }}-${{ steps.chunk.outputs.chunkNumber }}
path: issue-bot/tmp/results-${{ steps.chunk.outputs.phpVersion }}-*.tmp

evaluate:
name: "Evaluate results"
Expand Down
5 changes: 4 additions & 1 deletion issue-bot/src/Console/DownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!in_array(80400, $resultPhpVersions, true)) {
$resultPhpVersions[] = 80400;
}
if (!in_array(80500, $resultPhpVersions, true)) {
$resultPhpVersions[] = 80500;
}

if (!in_array($phpVersion, $resultPhpVersions, true)) {
continue;
Expand All @@ -141,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}

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

return 0;
}
Expand Down
Loading