Skip to content

chore: Change the name and icon of AM-GUI beta version #21

chore: Change the name and icon of AM-GUI beta version

chore: Change the name and icon of AM-GUI beta version #21

Workflow file for this run

name: Validate app files

Check warning on line 1 in .github/workflows/validate-apps.yml

View workflow run for this annotation

GitHub Actions / Validate app files

Workflow execution policy warning (evaluate mode)

On November 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
on:
pull_request_target:
paths:
- 'apps/**'
permissions:
contents: read
pull-requests: write
jobs:
validate:
runs-on: ubuntu-latest
container:
image: registry.gitlab.com/kazam0180/pla-site-tool:latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
allow-unsafe-pr-checkout: true
- name: Mark workspace as safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Get modified app files
id: changed
shell: bash
run: |
FILES=$(git diff --name-only --diff-filter=ACMR origin/main...HEAD -- 'apps/*' | grep -v '\.template$' || true)
echo "files<<EOF" >> $GITHUB_OUTPUT
echo "$FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Validate files
if: steps.changed.outputs.files != ''
id: validate
shell: bash
run: |
INPUT_ARGS=""
while IFS= read -r file; do
[ -z "$file" ] && continue
INPUT_ARGS="$INPUT_ARGS -i $file"
done <<< "${{ steps.changed.outputs.files }}"
echo "Running: ./pla-site-tool $INPUT_ARGS validate-apps"
set +e
STDERR=$(pla-site-tool $INPUT_ARGS validate-apps 2>&1)
EXIT_CODE=$?
set -e
echo "$STDERR"
if [ $EXIT_CODE -ne 0 ]; then
echo "STDERR<<EOF" >> $GITHUB_OUTPUT
echo "$STDERR" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "has_failed=true" >> $GITHUB_OUTPUT
else
echo "has_failed=false" >> $GITHUB_OUTPUT
fi
- name: Comment on PR
if: steps.validate.outputs.has_failed == 'true'
uses: actions/github-script@v9
with:
script: |
const stderr = `${{ steps.validate.outputs.stderr }}`.trim();
const body = `### App file validation failed\n\n${stderr}\n\nPlease check the file format against [\`apps/.template\`](https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/blob/main/apps/.template) and fix any syntax errors.`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(c => c.user.type === 'Bot' && c.body.includes('App file validation failed'));
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
- name: Fail if validation errors
if: steps.validate.outputs.has_failed == 'true'
run: |
echo "Validation failed for the files listed in the PR comment."
exit 1