Skip to content

Commit 31ab876

Browse files
authored
Merge branch refs/heads/2.1.x into 2.2.x
2 parents fa86019 + 6af46cc commit 31ab876

File tree

1 file changed

+0
-127
lines changed

1 file changed

+0
-127
lines changed

.github/workflows/issue-bot.yml

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -229,130 +229,3 @@ jobs:
229229
fi
230230
231231
exit $exit_code
232-
233-
regression-tests:
234-
name: "Generate regression tests"
235-
needs: evaluate
236-
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'phpstan-bot'
237-
runs-on: blacksmith-4vcpu-ubuntu-2404
238-
timeout-minutes: 60
239-
permissions:
240-
contents: read
241-
pull-requests: write
242-
243-
steps:
244-
- name: "Check for feedback loop"
245-
id: check
246-
env:
247-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248-
run: |
249-
COMMIT_MSG=$(gh api "repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha }}" --jq '.commit.message' 2>/dev/null || true)
250-
if [[ "$COMMIT_MSG" == "Add regression test for #"* ]]; then
251-
echo "Last commit was regression test addition, skipping"
252-
echo "skip=true" >> "$GITHUB_OUTPUT"
253-
else
254-
echo "skip=false" >> "$GITHUB_OUTPUT"
255-
fi
256-
257-
- name: "Checkout"
258-
if: steps.check.outputs.skip != 'true'
259-
uses: actions/checkout@v4
260-
with:
261-
ref: ${{ github.head_ref }}
262-
fetch-depth: 0
263-
264-
- name: "Download step summary"
265-
if: steps.check.outputs.skip != 'true'
266-
uses: actions/download-artifact@v4
267-
with:
268-
name: step-summary
269-
path: ./tmp
270-
271-
- name: "Install PHP"
272-
if: steps.check.outputs.skip != 'true'
273-
uses: "shivammathur/setup-php@v2"
274-
with:
275-
coverage: "none"
276-
php-version: "8.4"
277-
ini-file: development
278-
extensions: mbstring
279-
280-
- name: "Install dependencies"
281-
if: steps.check.outputs.skip != 'true'
282-
uses: "ramsey/composer-install@v3"
283-
284-
- name: "Save HEAD before generation"
285-
if: steps.check.outputs.skip != 'true'
286-
id: before
287-
run: |
288-
git config user.name "phpstan-bot"
289-
git config user.email "ondrej+phpstanbot@mirtes.cz"
290-
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
291-
292-
- name: "Generate regression tests"
293-
if: steps.check.outputs.skip != 'true'
294-
uses: anthropics/claude-code-action@v1
295-
with:
296-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
297-
claude_args: "--model claude-opus-4-6"
298-
prompt: |
299-
Read the file ./tmp/step-summary.md which contains the Issue Bot step summary from CI in Markdown format. Interpret this Markdown to figure out which GitHub issues need regression tests added. For each affected issue (where behavior changed), run /regression-test with the issue number.
300-
301-
Also read the diff of this branch to see what has already been done. The primary fixed issue will already have a test committed. The Issue Bot step summary might mention other fixed issues, so please add regression tests for those.
302-
303-
Do not create a branch or push - this will be handled automatically.
304-
305-
- name: "Push"
306-
if: steps.check.outputs.skip != 'true'
307-
run: |
308-
if [ "$(git rev-parse HEAD)" = "$(git rev-parse @{u})" ]; then
309-
echo "No new commits to push"
310-
exit 0
311-
fi
312-
313-
git push
314-
315-
- name: "Update PR description"
316-
if: steps.check.outputs.skip != 'true'
317-
env:
318-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
319-
BEFORE_SHA: ${{ steps.before.outputs.sha }}
320-
run: |
321-
CURRENT_SHA="$(git rev-parse HEAD)"
322-
323-
if [ "$BEFORE_SHA" = "$CURRENT_SHA" ]; then
324-
echo "No new commits, skipping PR description update"
325-
exit 0
326-
fi
327-
328-
# Extract issue numbers from new commit messages
329-
ISSUE_NUMBERS=$(git log --format='%s' "$BEFORE_SHA".."$CURRENT_SHA" | grep -oP '#\K[0-9]+' | sort -u)
330-
331-
if [ -z "$ISSUE_NUMBERS" ]; then
332-
echo "No issue numbers found in new commits"
333-
exit 0
334-
fi
335-
336-
# Get current PR body via REST API (avoids GraphQL scope requirements)
337-
PR_API="repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}"
338-
gh api "$PR_API" --jq '.body' > /tmp/pr-body.txt
339-
340-
# Append closes lines for issues not already in the body
341-
ADDED=false
342-
for NUM in $ISSUE_NUMBERS; do
343-
ISSUE_URL="https://github.com/phpstan/phpstan/issues/$NUM"
344-
if ! grep -qF "$ISSUE_URL" /tmp/pr-body.txt; then
345-
if [ "$ADDED" = false ]; then
346-
echo "" >> /tmp/pr-body.txt
347-
fi
348-
echo "Closes $ISSUE_URL" >> /tmp/pr-body.txt
349-
ADDED=true
350-
fi
351-
done
352-
353-
if [ "$ADDED" = false ]; then
354-
echo "All issues already referenced in PR description"
355-
exit 0
356-
fi
357-
358-
gh api "$PR_API" -X PATCH -f body="$(cat /tmp/pr-body.txt)"

0 commit comments

Comments
 (0)