diff --git a/.github/workflows/pull_request_closed.yml b/.github/workflows/pull_request_closed.yml
index a4815f833..818b00da7 100644
--- a/.github/workflows/pull_request_closed.yml
+++ b/.github/workflows/pull_request_closed.yml
@@ -22,7 +22,7 @@ jobs:
git clone --branch=pr-screenshots --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} pr-screenshots
cd pr-screenshots
- rm -f ${{ github.event.number }}_*.png
+ rm -f ${{ github.event.number }}-*.png
# Force push to pr-screenshots branch
git checkout --orphan temporary
diff --git a/.github/workflows/pull_request_comment.yml b/.github/workflows/pull_request_comment.yml
index 680eeaf3d..57daadeba 100644
--- a/.github/workflows/pull_request_comment.yml
+++ b/.github/workflows/pull_request_comment.yml
@@ -88,7 +88,7 @@ jobs:
for file in ../screenshots/*; do
if [[ -f "$file" ]]; then
filename=$(basename "$file")
- cp -f "$file" "./${{ steps.fetch-pr-number.outputs.pr_number }}_${filename}"
+ cp -f "$file" "./${{ steps.fetch-pr-number.outputs.pr_number }}-${filename}"
fi
done
@@ -105,6 +105,9 @@ jobs:
uses: actions/github-script@v7
with:
script: |
+ const fs = require('fs');
+ const path = require('path');
+
var issue_number = ${{ steps.fetch-pr-number.outputs.pr_number }};
const owner = context.repo.owner;
const repo = context.repo.repo;
@@ -134,72 +137,47 @@ jobs:
var statusText = `Build successful. APKs to test: ${artifact_url}.`;
- var androidScreenshots = `
-
-
-  |
-  |
-  |
-  |
-
-
-  |
-  |
-
-
- |
-
-
- `;
-
- var iPhoneScreenshots = `
-
-
-  |
-  |
-  |
-  |
-
-
-  |
-  |
-
-
- |
-
-
- `;
+ const screenshotsDir = 'pr-screenshots';
+ let deviceScreenshots = {};
+
+ if (fs.existsSync(screenshotsDir)) {
+ const files = fs.readdirSync(screenshotsDir);
+
+ files.forEach(file => {
+ const match = file.match(new RegExp(`^${issue_number}-(.+?)-.+\\.png$`));
+ if (match) {
+ const deviceName = match[1];
+ if (!deviceScreenshots[deviceName]) {
+ deviceScreenshots[deviceName] = [];
+ }
+ deviceScreenshots[deviceName].push(file);
+ }
+ });
+ }
- var iPadScreenshots = `
-
-
- -1_home_screen.png?raw=true) |
- -2_text_badge.png?raw=true) |
- -3_emoji_badge.png?raw=true) |
- -4_inverted_emoji_badge.png?raw=true) |
-
-
- -5_saved_badges.png?raw=true) |
- -6_saved_badges_clicked.png?raw=true) |
-
-
- |
-
-
- `;
+ var screenshotsHtml = Object.entries(deviceScreenshots).map(([device, images]) => {
+ images.sort();
+ let tableRows = "";
+ for (let i = 0; i < images.length; i += 4) {
+ tableRows += `
+
+  |
+ ${images[i + 1] ? ` | ` : ""}
+ ${images[i + 2] ? ` | ` : ""}
+ ${images[i + 3] ? ` | ` : ""}
+
`;
+ }
+ return `
+ ## Screenshots (${device.replace(/_/g, " ")})
+
+ `;
+ }).join("\n");
const body = `
## Build Status
${statusText}
- ## Screenshots (Android)
- ${androidScreenshots}
-
- ## Screenshots (iPhone)
- ${iPhoneScreenshots}
-
- ## Screenshots (iPad)
- ${iPadScreenshots}
+ ${screenshotsHtml}
`;
if (comment_id) {