Skip to content

Commit 87dc516

Browse files
committed
Fix PR comments for forked submissions
1 parent c34c7cf commit 87dc516

1 file changed

Lines changed: 23 additions & 24 deletions

File tree

.github/workflows/pr-check-pictures.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Check new board assets exist (images + vendor logos)"
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
paths:
66
- "config/boards/**"
77

@@ -20,6 +20,7 @@ jobs:
2020
permissions:
2121
contents: read
2222
pull-requests: write
23+
issues: write
2324

2425
steps:
2526
- name: "Checkout build repo (PR head)"
@@ -71,12 +72,11 @@ jobs:
7172
comment_file="$(mktemp)"
7273
7374
{
74-
echo ""
7575
echo "This PR adds new board configuration(s). Required assets must already exist in [github/${WEBSITE_REPO}](https://github.com/${WEBSITE_REPO})."
7676
echo "They are required by [Armbian Imager](https://github.com/armbian/imager) to ensure all boards are displayed with proper images."
7777
echo ""
78-
echo "- Board images: \`${BOARD_IMAGES_DIR}/<board>.png\`"
79-
echo "- Vendor logos: \`${VENDOR_LOGOS_DIR}/<vendor>-logo.png\`"
78+
echo "- Board images: \`${BOARD_IMAGES_DIR}/<board>.png\` (1920x1080 px transparent)"
79+
echo "- Vendor logos: \`${VENDOR_LOGOS_DIR}/<vendor>-logo.png\` (512x512 px transparent)"
8080
echo ""
8181
echo "### Missing items"
8282
echo ""
@@ -126,7 +126,7 @@ jobs:
126126
if [[ -z "${found_logo}" ]]; then
127127
{
128128
echo "- ❌ **Vendor logo missing** for vendor \`${vendor}\` (used by board \`${board}\`)"
129-
echo " - Expected: \`${VENDOR_LOGOS_DIR}/${vendor}-logo.(png|jpg|jpeg|svg)\`"
129+
echo " - Expected: \`${VENDOR_LOGOS_DIR}/${vendor}-logo.png\`"
130130
echo " - Fix: add the file to **${WEBSITE_REPO}** (folder \`${VENDOR_LOGOS_DIR}/\`)"
131131
echo " - Naming rules: lowercase, dashes (e.g. \`kobol-logo.png\`, not \`Kobol_logo.png\`)"
132132
echo ""
@@ -146,25 +146,24 @@ jobs:
146146
fi
147147
148148
- name: "Comment on PR with missing asset instructions"
149-
if: always() && github.event_name == 'pull_request' && steps.validate.outputs.missing == 'true'
149+
if: always() && github.event_name == 'pull_request_target' && steps.validate.outputs.missing == 'true'
150150
uses: actions/github-script@v7
151151
env:
152-
COMMENT_BODY: ${{ steps.validate.outputs.comment }}
153-
WEBSITE_REPO: ${{ env.WEBSITE_REPO }}
152+
COMMENT_BODY: ${{ steps.validate.outputs.comment }}
153+
WEBSITE_REPO: ${{ env.WEBSITE_REPO }}
154154
with:
155-
github-token: ${{ secrets.GITHUB_TOKEN }}
156-
script: |
157-
const body =
158-
`### 🚫 Missing required board assets
159-
160-
${process.env.COMMENT_BODY}
161-
162-
Once the missing files are added (or a PR is opened in **${process.env.WEBSITE_REPO}**), re-run this check.
163-
`;
164-
165-
await github.rest.issues.createComment({
166-
owner: context.repo.owner,
167-
repo: context.repo.repo,
168-
issue_number: context.issue.number,
169-
body
170-
});
155+
github-token: ${{ secrets.GITHUB_TOKEN }}
156+
script: |
157+
const body =
158+
`### 🚫 Missing required board assets
159+
160+
${process.env.COMMENT_BODY}
161+
162+
Once the missing files are added (or a PR is opened in **${process.env.WEBSITE_REPO}**), re-run this check.
163+
`;
164+
await github.rest.issues.createComment({
165+
owner: context.repo.owner,
166+
repo: context.repo.repo,
167+
issue_number: context.issue.number,
168+
body
169+
});

0 commit comments

Comments
 (0)