Skip to content

Build script catalog #4

Build script catalog

Build script catalog #4

Workflow file for this run

name: Build script catalog
# Manually regenerates index.json - the catalog PaletteShell's in-palette "Browse community
# scripts" page fetches - from whatever is actually under scripts/. Contributors never touch
# index.json themselves; run this workflow when the committed catalog should be refreshed.
on:
workflow_dispatch: {}
permissions:
contents: write
concurrency:
group: build-index-${{ github.ref }}
cancel-in-progress: true
jobs:
build-index:
runs-on: ubuntu-latest
steps:
# Full history (not the default shallow depth-1 clone) - Build-Index.ps1 runs `git log`
# per script to record each file's last-modified commit date, which needs the actual
# history to be present, not just the tip commit.
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Manual runs are restricted to codeowners (.github/CODEOWNERS).
- name: Restrict manual runs to codeowners
env:
ACTOR: ${{ github.actor }}
run: |
if ! grep -qiE "@${ACTOR}([[:space:]]|$)" .github/CODEOWNERS; then
echo "::error::Manual runs of this workflow are restricted to codeowners. '${ACTOR}' is not listed in .github/CODEOWNERS."
exit 1
fi
- name: Build index.json
shell: pwsh
run: ./tools/Build-Index.ps1
- name: Check for changes
id: diff
run: |
git add index.json
if git diff --cached --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit index.json
if: steps.diff.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update index.json"
git push