Repository navigation
chore(index): 收录 Java Navigation 0.0.2 #133
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate index | |
| # Every change to the index must pass the same rules Lithe applies to a | |
| # third-party source; new or changed archives are downloaded and checked. | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| schedule: | |
| # Weekly re-check of every listed archive: release assets can be deleted | |
| # or replaced after they were merged. | |
| - cron: "17 3 * * 1" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: validate-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Unit tests | |
| run: node --test scripts/store.test.mjs | |
| - name: Validate index | |
| run: node scripts/validate-index.mjs lithe-plugin-index.json | |
| - name: Pick the base index | |
| id: base | |
| run: | | |
| case "${{ github.event_name }}" in | |
| pull_request) ref="origin/${{ github.base_ref }}" ;; | |
| push) ref="${{ github.event.before }}" ;; | |
| *) ref="" ;; | |
| esac | |
| if [ -n "$ref" ] && git show "$ref:lithe-plugin-index.json" > "$RUNNER_TEMP/base-index.json" 2>/dev/null; then | |
| echo "args=--base $RUNNER_TEMP/base-index.json" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "args=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Verify archives (checksum and plugin.json) | |
| run: node scripts/validate-index.mjs lithe-plugin-index.json --verify-archives ${{ steps.base.outputs.args }} | |
| - name: Check the index contract has not changed | |
| # validate-index.mjs follows the index rules of the Lithe plugin | |
| # contract (v0), published in the Rust Core repository under | |
| # shared/plugins/contract/v1. A different schema there means the rules | |
| # changed; see docs/maintainers.md. | |
| env: | |
| SCHEMA_URL: https://raw.githubusercontent.com/Lithe-IDEA/Lithe-core-rust/main/shared/plugins/contract/v1/plugin-index.schema.json | |
| SCHEMA_SHA256: 18451ea7969bbf1c28a7df0554718c62599156e1155519059a6a9d16b9f89bea | |
| run: | | |
| status=$(curl -sS -o "$RUNNER_TEMP/plugin-index.schema.json" -w '%{http_code}' "$SCHEMA_URL") | |
| if [ "$status" = "404" ]; then | |
| echo "::error::Lithe-core-rust no longer publishes shared/plugins/contract/v1/plugin-index.schema.json; find where the contract moved and update SCHEMA_URL; see docs/maintainers.md." | |
| exit 1 | |
| elif [ "$status" != "200" ]; then | |
| echo "::warning::Could not fetch the published schema (HTTP $status)." | |
| else | |
| actual=$(sha256sum "$RUNNER_TEMP/plugin-index.schema.json" | cut -d' ' -f1) | |
| if [ "$actual" != "$SCHEMA_SHA256" ]; then | |
| echo "::error::The published plugin-index.schema.json changed (SHA-256 $actual). Update validate-index.mjs, scripts/fixtures and SCHEMA_SHA256 together; see docs/maintainers.md." | |
| exit 1 | |
| fi | |
| fi |