mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-21 05:55:42 +08:00
* 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
56 lines
1.9 KiB
YAML
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
|