diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml index 2c0f555153..b31b51fa54 100644 --- a/.github/workflows/preview-deploy.yml +++ b/.github/workflows/preview-deploy.yml @@ -252,7 +252,7 @@ jobs: COMMIT_INFO_MESSAGE: ${{ github.event.workflow_run.head_commit.message }} COMMIT_INFO_AUTHOR: ${{ github.event.workflow_run.head_commit.author.name }} COMMIT_INFO_EMAIL: ${{ github.event.workflow_run.head_commit.author.email }} - COMMIT_INFO_REMOTE: ${{ github.event.workflow_run.head_repository.clone_url }} + COMMIT_INFO_REMOTE: ${{ github.event.workflow_run.head_repository.html_url }} run: | set -euo pipefail [[ $PR =~ ^[0-9]+$ ]] || { echo "Bad pull request number" >&2; exit 1; } @@ -289,6 +289,18 @@ jobs: echo "$share" url=$(grep -oE 'https://[^[:space:])>]+' <<< "$share" | head -1) [[ $url =~ ^https:// ]] && echo "share_url=$url" >> "$GITHUB_OUTPUT" + # The CLI prints no link per file, so take them from the Attachments section of the + # share page's Markdown. Writes "kindnameurl" lines for the next step. + md=$(sed -n 's/^Markdown: \(https:\/\/[^[:space:]]*\)$/\1/p' <<< "$share" | head -1) + if [[ $md =~ ^https://s\.crts\.sh/ ]]; then + curl -fsSL --max-time 30 "$md" \ + | awk '/^## / {inside = ($0 == "## Attachments")} inside' \ + | sed -nE \ + -e 's#^- (screenshot|video) \[([^]]+)\]\((https://s\.crts\.sh/at/[A-Za-z0-9_-]+)\)$#\1\t\2\t\3#p' \ + -e 's#^- trace \[[^]]+\]\(https://t\.crts\.sh/([A-Za-z0-9_-]+)\).*$#animation\t-\thttps://t.crts.sh/\1/animation#p' \ + > "$RUNNER_TEMP/currents-media.tsv" || true + cat "$RUNNER_TEMP/currents-media.tsv" + fi - name: Update the description env: GH_TOKEN: ${{ github.token }} @@ -323,13 +335,33 @@ jobs: key="pr-agent/$PR/$HEAD_SHA" python3 .github/scripts/pr-screenshots.py prepare "$RESULT" "$shots" \ "${PLAYWRIGHT_PUBLIC_BASE_URL%/}/$key" "$out" + media="$RUNNER_TEMP/currents-media.tsv" + extra="$out/extra.md" + : > "$extra" if [[ -z ${S3_BUCKET:-} && -s $out/section.md ]]; then - grep -v '^!\[' "$out/section.md" > "$out/section.tmp" && mv "$out/section.tmp" "$out/section.md" + # Show the Currents session's copies instead. GitHub drops