Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
30c231a
Open 2.2.x
ondrejmirtes Feb 13, 2026
fe8c9bb
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
57f27b6
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
313ebe5
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
1718ecc
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
0006215
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
1272139
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
5add2a9
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
e4e435b
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
bd31d25
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 13, 2026
19447f1
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 14, 2026
0d1f531
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 14, 2026
b7d3172
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 14, 2026
25b268b
Add agentic workflow to document new config parameters
ondrejmirtes Feb 14, 2026
547f128
Add gh-aw infrastructure files
ondrejmirtes Feb 14, 2026
080bafa
Fix manual dispatch to check all parameters, not just diff
ondrejmirtes Feb 14, 2026
2a5eaba
Skip level-only parameters in config docs workflow
ondrejmirtes Feb 14, 2026
3bb4431
Fix cross-repo patch by pre-fetching config-reference.md
ondrejmirtes Feb 14, 2026
afa5966
Fix git identity for pre-step commit on CI runner
ondrejmirtes Feb 14, 2026
97f58a0
Use direct checkout and bash PR creation instead of safe-outputs
ondrejmirtes Feb 14, 2026
da9ed28
Add main repo checkout so gh-aw git config step works
ondrejmirtes Feb 14, 2026
5c6e070
Correct username
ondrejmirtes Feb 14, 2026
5abeb3c
Instruct agent to extract nested parameters from schema
ondrejmirtes Feb 14, 2026
a712fce
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 14, 2026
f9efbdc
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 14, 2026
34a77ac
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 15, 2026
8263f6a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 15, 2026
4512e57
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 15, 2026
450cf52
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 15, 2026
5ae8cfd
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
b43a04b
Fix Claude PR reactions workflow: don't cancel in-progress runs
ondrejmirtes Feb 16, 2026
cbba989
Merge remote-tracking branch 'origin/2.1.x' into 2.2.x
ondrejmirtes Feb 16, 2026
411c411
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
8b39a71
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
d145799
Improve Claude react workflow
ondrejmirtes Feb 16, 2026
7c6309c
Configure phpstan-bot git identity for Claude PR reactions workflow
ondrejmirtes Feb 16, 2026
c476b60
Split claude react-on-comment into two jobs to avoid expensive setup
claude Feb 16, 2026
f554b84
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
37c4f55
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
394461f
Fix Claude credentials to phpstan-bot
ondrejmirtes Feb 16, 2026
1297915
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
0c27812
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
0998ee8
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
72f877f
Add scheduled workflow to trigger Claude easy fixes nightly
ondrejmirtes Feb 16, 2026
c2da2e8
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 16, 2026
a7a7abc
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 17, 2026
8e131a9
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 17, 2026
20243ca
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 17, 2026
925c25a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
9712da0
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
2e145a5
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
e04947f
Merge 2.1.x
ondrejmirtes Feb 18, 2026
0e8466f
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
b7b2ba4
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
e94c5c8
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
18c1ef7
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
2fb5636
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
a10a9a2
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 18, 2026
0e54233
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
e696ed0
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
74d0ddf
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
fd4c63b
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
94a0731
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
394e477
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
0bfbaf9
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
8882d85
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
dc7d857
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
95584e1
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 19, 2026
95d2866
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
0807b1b
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
5a5255e
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
5dac347
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
fc0e899
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
6b26f28
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
1c5bad8
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 20, 2026
ad296c2
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
b4735ef
Update aw
ondrejmirtes Feb 21, 2026
b15ff63
Add document-phpdoc-tags workflow
ondrejmirtes Feb 21, 2026
45dea8d
Add document-phpdoc-types workflow
ondrejmirtes Feb 21, 2026
ceec281
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
c537128
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
bb5fd87
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
1cd9ef9
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
90089b5
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
ef25c91
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 21, 2026
7dfcbf1
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
8c2b2b4
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
19b0f0b
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
edb776f
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
463007a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
79e5543
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
9ef8c48
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
4e9dd5a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 22, 2026
7eb282d
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
69fa23c
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
becebaa
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
f9d0efe
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
f3b36e6
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
fe05703
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
842777b
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
d1a2026
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
af2bc4a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 23, 2026
2246d72
claude-random-easy-fixes-scheduled.yml - generate fixes for 20 issues…
ondrejmirtes Feb 22, 2026
14ee1c0
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
86353a4
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
d74052a
Remove agentic workflows
ondrejmirtes Feb 24, 2026
a47ba97
Merge branch '2.1.x' into 2.2.x
ondrejmirtes Feb 24, 2026
87b9010
One less need for a token
ondrejmirtes Feb 24, 2026
4b00cbf
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
b2d447a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
12b6f66
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
d7e9f7a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
58ad8e1
Merge remote-tracking branch 'origin/2.1.x' into 2.2.x
ondrejmirtes Feb 24, 2026
e5e64c7
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
fa86019
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
31ab876
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 24, 2026
5719ba9
[StepSecurity] ci: Harden GitHub Actions
step-security-bot Feb 24, 2026
1b1873c
Merge remote-tracking branch 'origin/2.1.x' into 2.2.x
ondrejmirtes Feb 24, 2026
7aca84b
Merge remote-tracking branch 'origin/2.1.x' into 2.2.x
ondrejmirtes Feb 24, 2026
e7d321d
Update branch
ondrejmirtes Feb 24, 2026
0324196
Fix
ondrejmirtes Feb 24, 2026
df51ee0
Fix
ondrejmirtes Feb 24, 2026
7a43104
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 25, 2026
4781276
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 25, 2026
d56346a
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 25, 2026
95070d4
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
33eba6f
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
79eb04f
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
6803e54
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
ed40e65
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
786479f
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
a7b310d
Merge branch refs/heads/2.1.x into 2.2.x
phpstan-bot Feb 26, 2026
0591587
Merge remote-tracking branch 'origin/2.1.x' into 2.2.x
ondrejmirtes Feb 26, 2026
b054374
Remove Claude workflow
ondrejmirtes Feb 26, 2026
76da17b
Proper Claude Fix Issue workflow (for the fork)
ondrejmirtes Feb 26, 2026
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.stub linguist-language=PHP

tests/PHPStan/Command/ErrorFormatter/data/WindowsNewlines.php eol=crlf

.github/workflows/*.lock.yml linguist-generated=true merge=ours
2 changes: 1 addition & 1 deletion .github/workflows/backward-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
push:
branches:
- "2.1.x"
- "2.2.x"
paths:
- 'src/**'
- '.github/workflows/backward-compatibility.yml'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-issue-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '.github/workflows/build-issue-bot.yml'
push:
branches:
- "2.1.x"
- "2.2.x"
paths:
- 'issue-bot/**'
- '.github/workflows/build-issue-bot.yml'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '.github/workflows/changelog-generator.yml'
push:
branches:
- "2.1.x"
- "2.2.x"
paths:
- 'changelog-generator/**'
- '.github/workflows/changelog-generator.yml'
Expand Down
194 changes: 194 additions & 0 deletions .github/workflows/claude-fix-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: "Claude Fix Issue"

on:
workflow_dispatch:
inputs:
issue-number:
description: "Issue number from phpstan/phpstan repository"
required: true
type: string
workflow_call:
inputs:
issue-number:
description: "Issue number from phpstan/phpstan repository"
required: true
type: string

permissions:
contents: read

jobs:
fix:
name: "Fix #${{ inputs.issue-number }}"
runs-on: "ubuntu-latest"
timeout-minutes: 60
permissions:
contents: read
issues: read

Check warning

Code scanning / zizmor

permissions without explanatory comments Warning

permissions without explanatory comments
pull-requests: write

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit

- name: "Checkout"
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: 2.1.x

Check failure

Code scanning / octoscan

Use of 'actions/checkout' with a custom ref. Error

Use of 'actions/checkout' with a custom ref.
repository: phpstan/phpstan-src
fetch-depth: 0
Comment on lines +36 to +41

Check warning

Code scanning / zizmor

credential persistence through GitHub Actions artifacts Warning

credential persistence through GitHub Actions artifacts

- name: "Install PHP"
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
with:
coverage: "none"
php-version: "8.4"
ini-file: development
extensions: mbstring

- uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3

- name: "Install Claude Code"
run: npm install -g @anthropic-ai/claude-code

- name: "Fetch issue details"
id: issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ inputs.issue-number }}
run: |
ISSUE_JSON=$(gh issue view "$ISSUE_NUMBER" \
--repo phpstan/phpstan \
--json title,body,url)

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
TITLE=$(echo "$ISSUE_JSON" | jq -r '.title')

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
URL=$(echo "$ISSUE_JSON" | jq -r '.url')
echo "title=$TITLE" >> "$GITHUB_OUTPUT"
echo "url=$URL" >> "$GITHUB_OUTPUT"
echo "$ISSUE_JSON" | jq -r '.body' > /tmp/issue-body.txt

- name: "Run Claude Code"
env:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
GH_TOKEN: ${{ secrets.PHPSTAN_BOT_FORK_TOKEN }}
run: |
git config user.name "phpstan-bot"

Check failure

Code scanning / octoscan

Expression injection, "steps..outputs." is potentially untrusted. Error

Expression injection, "steps.**.outputs.**" is potentially untrusted.
git config user.email "ondrej+phpstanbot@mirtes.cz"

claude --model claude-opus-4-6 \
--dangerously-skip-permissions \
-p "$(cat << 'PROMPT_EOF'
You are working on phpstan/phpstan-src, the source code of PHPStan - a PHP static analysis tool.

Your task is to fix the following GitHub issue from the phpstan/phpstan repository:
Issue phpstan/phpstan#${{ inputs.issue-number }}: ${{ steps.issue.outputs.title }}

Check failure

Code scanning / zizmor

code injection via template expansion Error

code injection via template expansion

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion

Check notice

Code scanning / zizmor

code injection via template expansion Note

code injection via template expansion
URL: ${{ steps.issue.outputs.url }}

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion

Check notice

Code scanning / zizmor

code injection via template expansion Note

code injection via template expansion

Issue body is in the file /tmp/issue-body.txt — read it before proceeding.

## Step 1: Write a regression test

Read .claude/skills/regression-test/SKILL.md for detailed guidance on writing regression tests for PHPStan bugs.

The issue body is already provided above — start from Step 2 of the skill (deciding test type). For Step 1 (gathering context), you only need to fetch the playground samples from any playground links found in the issue body.

Skip Steps 5-6 of the skill (reverting fix and committing) — those are not needed here.

The regression test should fail without the fix — verify this by running it before implementing the fix.

## Step 2: Fix the bug

Implement the fix in the source code under src/. Common areas to look:
- src/Analyser/NodeScopeResolver.php - AST traversal and scope management
- src/Analyser/MutatingScope.php - Type tracking
- src/Analyser/TypeSpecifier.php - Type narrowing from conditions
- src/Type/ - Type system implementations
- src/Rules/ - Rule implementations
- src/Reflection/ - Reflection layer

Read CLAUDE.md for important guidelines about the codebase architecture and common patterns.

## Step 3: Verify the fix

1. Run the regression test to confirm it passes now
2. Run the full test suite: make tests
3. Run PHPStan self-analysis: make phpstan
4. Fix any failures that come up
5. Run make cs-fix to fix any coding standard violations
6. Run make name-collision and fix violations - add different tests in unique namespaces. If the function and class declarations are exactly the same, you can reuse them across files instead of duplicating them.

Do not create a branch, push, or create a PR - this will be handled automatically.

## Step 4: Write a summary

After completing the fix, write two files:

1. /tmp/commit-message.txt - A concise commit message (first line: short summary under 72 chars, then a blank line, then a few bullet points describing key changes). Example:
Fix array_key_exists narrowing for template types

- Added handling for TemplateType in TypeSpecifier when processing array_key_exists
- New regression test in tests/PHPStan/Analyser/nsrt/bug-12345.php
- The root cause was that TypeSpecifier did not unwrap template bounds before narrowing

2. /tmp/pr-description.md - A pull request description in this format:
## Summary
Brief description of what the issue was about and what the fix does.

## Changes
- Bullet points of specific code changes made
- Reference file paths where changes were made

## Root cause
Explain why the bug happened and how the fix addresses it.

## Test
Describe the regression test that was added.

Fixes phpstan/phpstan#${{ inputs.issue-number }}

Check failure

Code scanning / zizmor

code injection via template expansion Error

code injection via template expansion

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion

These files are critical - they will be used for the commit message and PR description.
PROMPT_EOF
)"

- name: "Read Claude's summary"

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
id: claude-summary
env:
ISSUE_NUMBER: ${{ inputs.issue-number }}
run: |
if [ -f /tmp/commit-message.txt ]; then
delimiter="EOF_$(openssl rand -hex 16)"
{
echo "commit_message<<${delimiter}"
cat /tmp/commit-message.txt
echo "${delimiter}"

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
} >> "$GITHUB_OUTPUT"
else

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
echo "commit_message=Fix #$ISSUE_NUMBER" >> "$GITHUB_OUTPUT"

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
fi

if [ -f /tmp/pr-description.md ]; then
delimiter="EOF_$(openssl rand -hex 16)"
{
echo "pr_body<<${delimiter}"
cat /tmp/pr-description.md
echo "${delimiter}"
} >> "$GITHUB_OUTPUT"
else
echo "pr_body=Fixes phpstan/phpstan#$ISSUE_NUMBER" >> "$GITHUB_OUTPUT"
fi
Comment on lines +1 to +180

Check warning

Code scanning / zizmor

insufficient job-level concurrency limits Warning

insufficient job-level concurrency limits

- name: "Create Pull Request"
id: create-pr
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
branch-token: ${{ secrets.PHPSTAN_BOT_FORK_TOKEN }}
token: ${{ secrets.PHPSTAN_BOT_PR_TOKEN }}
push-to-fork: phpstan-bot/phpstan-src
branch-suffix: random
delete-branch: true
title: "Fix #${{ inputs.issue-number }}: ${{ steps.issue.outputs.title }}"
body: ${{ steps.claude-summary.outputs.pr_body }}
committer: "phpstan-bot <ondrej+phpstanbot@mirtes.cz>"
commit-message: ${{ steps.claude-summary.outputs.commit_message }}
26 changes: 26 additions & 0 deletions .github/workflows/claude-random-easy-fixes-scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Claude Random Easy Fixes (Scheduled)"

on:
schedule:
# Run every day, 4 times, once an hour at :15, from 2pm CET (13:00 UTC) to 5pm CET (16:00 UTC)
- cron: '15 13-16 * * *'

permissions:
contents: read

jobs:
trigger:

Check notice

Code scanning / zizmor

workflow or action definition without a name Note

workflow or action definition without a name
runs-on: ubuntu-latest
permissions:
contents: read
actions: write

Check warning

Code scanning / zizmor

permissions without explanatory comments Warning

permissions without explanatory comments
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit

- name: Trigger Claude Random Easy Fixes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run claude-random-easy-fixes.yml -f issue_count=5 --repo ${{ github.repository }}

Check warning

Code scanning / zizmor

code injection via template expansion Warning

code injection via template expansion
91 changes: 91 additions & 0 deletions .github/workflows/claude-random-easy-fixes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "Claude Random Easy Fixes"

on:
workflow_dispatch:
inputs:
issue_count:
description: "Number of issues to pick and fix in parallel"
required: false
default: "1"
type: string

jobs:
pick-issues:
name: "Pick easy fix issues"
runs-on: ubuntu-latest
timeout-minutes: 5

outputs:
matrix: ${{ steps.pick-issues.outputs.matrix }}

permissions:
contents: read
issues: read

Check warning

Code scanning / zizmor

permissions without explanatory comments Warning

permissions without explanatory comments

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit

- name: "Pick random Easy fix issues"
id: pick-issues
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_COUNT: ${{ inputs.issue_count || '1' }}
run: |
# Look up milestone number for "Easy fixes"
MILESTONE_NUMBER=$(gh api "repos/phpstan/phpstan/milestones?per_page=100" \
--jq '.[] | select(.title == "Easy fixes") | .number')
if [ -z "$MILESTONE_NUMBER" ]; then
echo "Could not find 'Easy fixes' milestone"
exit 1
fi
# Fetch all open issues in the milestone using pagination
ISSUE_JSON=$(gh api --paginate \
"repos/phpstan/phpstan/issues?state=open&milestone=${MILESTONE_NUMBER}&per_page=100" \
--jq '[.[] | {number: .number, title: .title}]' \
| jq -s 'add // []')
TOTAL=$(echo "$ISSUE_JSON" | jq 'length')
if [ "$TOTAL" -eq 0 ]; then
echo "No issues found in Easy fixes milestone"
exit 1
fi
COUNT=$ISSUE_COUNT
if [ "$COUNT" -gt "$TOTAL" ]; then
COUNT=$TOTAL
fi
# Pick COUNT random unique issues
SELECTED=$(echo "$ISSUE_JSON" | python3 -c "
import json, sys, random
issues = json.load(sys.stdin)
random.shuffle(issues)
count = min(int('$COUNT'), len(issues))
print(json.dumps(issues[:count]))
")
echo "Selected $COUNT issue(s) for fixing"
for NUMBER in $(echo "$SELECTED" | jq -r '.[].number'); do
TITLE=$(echo "$SELECTED" | jq -r --argjson n "$NUMBER" '.[] | select(.number == $n) | .title')
echo "### Selected issue: #$NUMBER - $TITLE" >> "$GITHUB_STEP_SUMMARY"
done
echo "matrix=$(echo "$SELECTED" | jq -c '.')" >> "$GITHUB_OUTPUT"

Check failure

Code scanning / octoscan

Write to "$GITHUB_OUTPUT" in a bash script. Error

Write to "$GITHUB_OUTPUT" in a bash script.
easy-fix:
name: "Fix #${{ matrix.issue.number }}: ${{ matrix.issue.title }}"
needs: pick-issues
strategy:
fail-fast: false
matrix:
issue: ${{ fromJson(needs.pick-issues.outputs.matrix) }}
uses: ./.github/workflows/claude-fix-issue.yml

Check warning

Code scanning / zizmor

secrets unconditionally inherited by called workflow Warning

secrets unconditionally inherited by called workflow

Check failure

Code scanning / octoscan

Use of local workflow "./.github/workflows/claude-fix-issue.yml" Error

Use of local workflow "./.github/workflows/claude-fix-issue.yml"
with:
issue-number: ${{ matrix.issue.number }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- 'issue-bot/**'
push:
branches:
- "2.1.x"
- "2.2.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
push:
branches:
- "2.1.x"
- "2.2.x"

permissions: {}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
push:
branches:
- "2.1.x"
- "2.2.x"

concurrency:
group: lint-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
Expand Down
Loading
Loading