





















@@ -33,6 +33,7 @@ env:
3333PNPM_VERSION: "10.33.0"
3434OPENCLAW_BUILD_PRIVATE_QA: "1"
3535OPENCLAW_ENABLE_PRIVATE_QA_CLI: "1"
36+HAS_MANTIS_GITHUB_APP: ${{ secrets.MANTIS_GITHUB_APP_ID != '' && secrets.MANTIS_GITHUB_APP_PRIVATE_KEY != '' }}
36373738jobs:
3839authorize_actor:
@@ -266,10 +267,23 @@ jobs:
266267retention-days: 14
267268if-no-files-found: warn
268269270+ - name: Create Mantis GitHub App token
271+id: mantis_app_token
272+if: ${{ always() && inputs.pr_number != '' && env.HAS_MANTIS_GITHUB_APP == 'true' }}
273+uses: actions/create-github-app-token@v3
274+with:
275+app-id: ${{ secrets.MANTIS_GITHUB_APP_ID }}
276+private-key: ${{ secrets.MANTIS_GITHUB_APP_PRIVATE_KEY }}
277+owner: ${{ github.repository_owner }}
278+repositories: ${{ github.event.repository.name }}
279+permission-contents: write
280+permission-issues: write
281+permission-pull-requests: write
282+269283 - name: Comment PR with inline QA screenshots
270284if: ${{ always() && inputs.pr_number != '' && steps.run_mantis.outputs.output_dir != '' }}
271285env:
272-GH_TOKEN: ${{ github.token }}
286+GH_TOKEN: ${{ steps.mantis_app_token.outputs.token || github.token }}
273287TARGET_PR: ${{ inputs.pr_number }}
274288ARTIFACT_URL: ${{ steps.upload_artifact.outputs.artifact-url }}
275289BASELINE_SHA: ${{ needs.validate_refs.outputs.baseline_revision }}
@@ -359,8 +373,13 @@ jobs:
359373 if [[ -n "$comment_id" ]]; then
360374 comment_payload="$(mktemp)"
361375 jq -n --rawfile body "$comment_file" '{ body: $body }' > "$comment_payload"
362- gh api --method PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${comment_id}" --input "$comment_payload" >/dev/null
363- echo "Updated Mantis QA screenshot comment on PR #${TARGET_PR}."
376+ if gh api --method PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${comment_id}" --input "$comment_payload" >/dev/null; then
377+ echo "Updated Mantis QA screenshot comment on PR #${TARGET_PR}."
378+ else
379+ echo "::warning::Could not update existing Mantis QA screenshot comment ${comment_id}; creating a new one."
380+ gh pr comment "$TARGET_PR" --body-file "$comment_file"
381+ echo "Created Mantis QA screenshot comment on PR #${TARGET_PR}."
382+ fi
364383 else
365384 gh pr comment "$TARGET_PR" --body-file "$comment_file"
366385 echo "Created Mantis QA screenshot comment on PR #${TARGET_PR}."
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。