Fix PR comments for forked submissions

This commit is contained in:
Igor Pecovnik 2025-12-16 17:30:17 +01:00 committed by Igor
parent c34c7cf9c2
commit 87dc516cb5

View File

@ -1,7 +1,7 @@
name: "Check new board assets exist (images + vendor logos)"
on:
pull_request:
pull_request_target:
paths:
- "config/boards/**"
@ -20,6 +20,7 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: "Checkout build repo (PR head)"
@ -71,12 +72,11 @@ jobs:
comment_file="$(mktemp)"
{
echo ""
echo "This PR adds new board configuration(s). Required assets must already exist in [github/${WEBSITE_REPO}](https://github.com/${WEBSITE_REPO})."
echo "They are required by [Armbian Imager](https://github.com/armbian/imager) to ensure all boards are displayed with proper images."
echo ""
echo "- Board images: \`${BOARD_IMAGES_DIR}/<board>.png\`"
echo "- Vendor logos: \`${VENDOR_LOGOS_DIR}/<vendor>-logo.png\`"
echo "- Board images: \`${BOARD_IMAGES_DIR}/<board>.png\` (1920x1080 px transparent)"
echo "- Vendor logos: \`${VENDOR_LOGOS_DIR}/<vendor>-logo.png\` (512x512 px transparent)"
echo ""
echo "### Missing items"
echo ""
@ -126,7 +126,7 @@ jobs:
if [[ -z "${found_logo}" ]]; then
{
echo "- ❌ **Vendor logo missing** for vendor \`${vendor}\` (used by board \`${board}\`)"
echo " - Expected: \`${VENDOR_LOGOS_DIR}/${vendor}-logo.(png|jpg|jpeg|svg)\`"
echo " - Expected: \`${VENDOR_LOGOS_DIR}/${vendor}-logo.png\`"
echo " - Fix: add the file to **${WEBSITE_REPO}** (folder \`${VENDOR_LOGOS_DIR}/\`)"
echo " - Naming rules: lowercase, dashes (e.g. \`kobol-logo.png\`, not \`Kobol_logo.png\`)"
echo ""
@ -146,25 +146,24 @@ jobs:
fi
- name: "Comment on PR with missing asset instructions"
if: always() && github.event_name == 'pull_request' && steps.validate.outputs.missing == 'true'
if: always() && github.event_name == 'pull_request_target' && steps.validate.outputs.missing == 'true'
uses: actions/github-script@v7
env:
COMMENT_BODY: ${{ steps.validate.outputs.comment }}
WEBSITE_REPO: ${{ env.WEBSITE_REPO }}
COMMENT_BODY: ${{ steps.validate.outputs.comment }}
WEBSITE_REPO: ${{ env.WEBSITE_REPO }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body =
`### 🚫 Missing required board assets
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body =
`### 🚫 Missing required board assets
${process.env.COMMENT_BODY}
${process.env.COMMENT_BODY}
Once the missing files are added (or a PR is opened in **${process.env.WEBSITE_REPO}**), re-run this check.
`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
Once the missing files are added (or a PR is opened in **${process.env.WEBSITE_REPO}**), re-run this check.
`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});