Skip to content

App showcase

App showcase #8

Workflow file for this run

name: App showcase
on:
pull_request:
paths:
- app.json
- .github/workflows/app-showcase.yml
- Scripts/update_app_showcase.py
- Scripts/tests/test_update_app_showcase.py
pull_request_target:
paths:
- app.json
push:
branches: [main]
paths:
- app.json
- Scripts/update_app_showcase.py
schedule:
- cron: "23 4 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: app-showcase-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test generator
run: python3 -m unittest discover -s Scripts/tests
- name: Validate App Store IDs
run: python3 Scripts/update_app_showcase.py
update-pr:
if: >-
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out trusted generator
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Fetch proposed app registry
env:
GH_TOKEN: ${{ github.token }}
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: >-
gh api
-H "Accept: application/vnd.github.raw+json"
"/repos/${HEAD_REPOSITORY}/contents/app.json?ref=${HEAD_SHA}"
> "${RUNNER_TEMP}/app.json"
- name: Generate showcase with trusted script
run: >-
python3 Scripts/update_app_showcase.py
--registry "${RUNNER_TEMP}/app.json"
- name: Preserve generated README
run: cp README.md "${RUNNER_TEMP}/README.md"
- name: Check out pull request branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Commit generated showcase to PR
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
rm -f README.md
cp "${RUNNER_TEMP}/README.md" README.md
if git diff --quiet -- README.md; then
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "docs: refresh app showcase"
git push origin "HEAD:${HEAD_REF}"
update:
if: >-
github.event_name == 'push' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test generator
run: python3 -m unittest discover -s Scripts/tests
- name: Generate app showcase
run: python3 Scripts/update_app_showcase.py
- name: Commit refreshed metadata
run: |
if git diff --quiet -- README.md; then
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "docs: refresh app showcase"
git push