Files
teleport/.github/workflows/e2e-pr-comment.yaml
T
Ryan Clark 575f5013dc Supporting changes for enterprise e2e tests (#65584)
* Move the e2e workflow to be composable

* Add support for tctl applying resources on Teleport start

* Always run playwright from OSS directory

* Copy session summaries over, adjusting end event/inference times

* Do not fix the viewport when browsing

* Fix bad rebase

* pnpm format
2026-05-08 15:35:14 +00:00

56 lines
1.9 KiB
YAML

name: Update E2E PR Comment
on:
workflow_call: {}
jobs:
update-pr-comment:
name: Update PR comment
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: write
steps:
- name: Download PR comment artifact
id: download
uses: actions/download-artifact@v8
with:
name: pr-comment
path: pr-comment
continue-on-error: true
- name: Update PR comment
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
comment_file="pr-comment/pr-comment.md"
marker="<!-- e2e-test-results -->"
pr_number="${{ github.event.pull_request.number }}"
# Find existing comment ID with the marker.
comment_id=$(gh api "repos/${{ github.repository }}/issues/${pr_number}/comments" \
--paginate --jq ".[] | select(.user.type == \"Bot\") | select(.body | contains(\"${marker}\")) | .id" \
| head -n1)
if [ "${{ steps.download.outcome }}" == "success" ] && [ -f "$comment_file" ] && [ -s "$comment_file" ]; then
# File has content — update or create comment.
if [ -n "$comment_id" ]; then
gh api -X PATCH "repos/${{ github.repository }}/issues/comments/${comment_id}" \
-F body=@"$comment_file"
echo "Updated E2E results PR comment"
else
gh api -X POST "repos/${{ github.repository }}/issues/${pr_number}/comments" \
-F body=@"$comment_file"
echo "Created E2E results PR comment"
fi
elif [ -n "$comment_id" ]; then
# No file or empty file — delete existing comment.
gh api -X DELETE "repos/${{ github.repository }}/issues/comments/${comment_id}"
echo "Deleted existing E2E results PR comment"
else
echo "No comment to update"
fi