Merge branch 'v3' into v3c/fix-builds

This commit is contained in:
Jerry Ma
2026-07-08 10:06:19 +08:00
committed by GitHub
3 changed files with 59 additions and 18 deletions

View File

@@ -0,0 +1,48 @@
name: Post Test Bot Comment
on:
workflow_run:
workflows: ["v3 Tests"]
types: [completed]
permissions:
pull-requests: write
actions: read
jobs:
post-comment:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Download bot output
id: download
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: bot-output
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Post/Update comment
if: steps.download.outcome == 'success'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
COMMENT_BODY=$(jq -r '.comment_body' bot-output.json)
PR_NUMBER=$(jq -r '.pr_number' bot-output.json)
MARKER="<!-- spc-test-bot -->"
# Find existing bot comment id
EXISTING_ID=$(gh api \
"repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
--jq "[.[] | select(.body | startswith(\"${MARKER}\")) | .id] | first // empty")
if [ -n "$EXISTING_ID" ]; then
gh api --method PATCH \
"repos/${{ github.repository }}/issues/comments/${EXISTING_ID}" \
-f body="$COMMENT_BODY"
else
gh pr comment "$PR_NUMBER" \
--repo "${{ github.repository }}" \
--body "$COMMENT_BODY"
fi

View File

@@ -131,7 +131,6 @@ jobs:
if: needs.check-gate.outputs.enabled == 'true' if: needs.check-gate.outputs.enabled == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
pull-requests: write
contents: read contents: read
outputs: outputs:
need_test: ${{ steps.bot.outputs.need_test }} need_test: ${{ steps.bot.outputs.need_test }}
@@ -168,23 +167,17 @@ jobs:
echo "php_versions=$(echo "$BOT_JSON" | jq -c '.php_versions')" >> "$GITHUB_OUTPUT" echo "php_versions=$(echo "$BOT_JSON" | jq -c '.php_versions')" >> "$GITHUB_OUTPUT"
echo "tier2=$(echo "$BOT_JSON" | jq -r '.tier2')" >> "$GITHUB_OUTPUT" echo "tier2=$(echo "$BOT_JSON" | jq -r '.tier2')" >> "$GITHUB_OUTPUT"
COMMENT_BODY=$(echo "$BOT_JSON" | jq -r '.comment_body') # Save JSON for the comment-posting workflow
MARKER="<!-- spc-test-bot -->" jq -n --argjson bot "$BOT_JSON" \
--arg pr '${{ github.event.pull_request.number }}' \
'$bot + {pr_number: $pr}' > bot-output.json
# Find existing bot comment id - name: Upload bot output
EXISTING_ID=$(gh api \ uses: actions/upload-artifact@v4
repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ with:
--jq "[.[] | select(.body | startswith(\"$MARKER\")) | .id] | first // empty") name: bot-output
path: bot-output.json
if [ -n "$EXISTING_ID" ]; then retention-days: 1
gh api --method PATCH \
repos/${{ github.repository }}/issues/comments/"$EXISTING_ID" \
-f body="$COMMENT_BODY"
else
gh pr comment ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--body "$COMMENT_BODY"
fi
gen-matrix: gen-matrix:
name: "Generate test matrix" name: "Generate test matrix"

View File

@@ -20,7 +20,7 @@ class curl
// which requires secur32.lib for SSL/TLS functions (SslEncryptPackage, etc.). // which requires secur32.lib for SSL/TLS functions (SslEncryptPackage, etc.).
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: ''; $extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
if (!str_contains($extra_libs, 'secur32.lib')) { if (!str_contains($extra_libs, 'secur32.lib')) {
putenv('SPC_EXTRA_LIBS=' . trim($extra_libs . ' secur32.lib')); putenv('SPC_EXTRA_LIBS=' . trim("{$extra_libs} secur32.lib"));
} }
} }
} }