From 4b806fe76dfb177b9622fbbd618fd51672762ecd Mon Sep 17 00:00:00 2001 From: stevelr Date: Fri, 21 Aug 2026 18:55:26 +0000 Subject: [PATCH] Nightly workflow to update community projects: - runs at 02:17 UTC - validates community-projects.json agsinst JSON schema - runs bun lint - updates community project stars - deploys to github pages --- .../workflows/update_community_projects.yml | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/update_community_projects.yml diff --git a/.github/workflows/update_community_projects.yml b/.github/workflows/update_community_projects.yml new file mode 100644 index 00000000..886e7ac0 --- /dev/null +++ b/.github/workflows/update_community_projects.yml @@ -0,0 +1,80 @@ +name: Update community projects + +on: + schedule: + - cron: "17 2 * * *" + workflow_dispatch: + +permissions: + contents: write + pages: write + +concurrency: + group: update-community-projects + cancel-in-progress: false + +jobs: + update: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout default branch + uses: actions/checkout@v7 + with: + ref: ${{ github.event.repository.default_branch }} + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Install JSON Schema validator + run: python -m pip install check-jsonschema==0.37.4 + + - name: Validate community projects data + run: check-jsonschema --schemafile data/community-projects.schema.json data/community-projects.json + + - name: Run linter + run: bun run lint + + - name: Update community projects + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: bun run gen-community-projects + + - name: Stage and check for changes + id: changes + run: | + git add data/community-projects.json docs/examples/community docs/examples/overview.mdx + if git diff --cached --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Build project + if: steps.changes.outputs.changed == 'true' + run: bun run build + + - name: Commit and push changes + if: steps.changes.outputs.changed == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "chore: update community project stars" + git push origin "HEAD:${{ github.event.repository.default_branch }}" + + - name: Deploy to GitHub Pages + if: steps.changes.outputs.changed == 'true' + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build + cname: developers.anytype.io