Repository navigation
[Showcase][zh-CN] LittleMemeWorld: QCA as the application and evolution foundation #27
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 content | |
| on: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: validate-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| MERGE_REF: refs/pull/${{ github.event.pull_request.number }}/merge | |
| MERGE_SHA: ${{ github.sha }} | |
| ASSOCIATION: ${{ github.event.pull_request.author_association }} | |
| HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} | |
| REPOSITORY: ${{ github.repository }} | |
| steps: | |
| - name: Check out trusted tooling | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 | |
| with: | |
| ref: ${{ env.BASE_SHA }} | |
| path: trusted | |
| persist-credentials: false | |
| - name: Check out submission as data | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 | |
| with: | |
| ref: ${{ env.MERGE_REF }} | |
| path: submission | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: trusted/package-lock.json | |
| - name: Install trusted dependencies | |
| working-directory: trusted | |
| run: npm ci --ignore-scripts | |
| - name: Calculate changed files | |
| run: git -C submission diff --name-only "$BASE_SHA...$HEAD_SHA" > changed-files.txt | |
| - name: Enforce contribution scope | |
| shell: bash | |
| run: | | |
| args=(--files changed-files.txt) | |
| if [[ "$HEAD_REPO" == "$REPOSITORY" ]]; then | |
| case "$ASSOCIATION" in OWNER|MEMBER|COLLABORATOR) args+=(--allow-infrastructure) ;; esac | |
| fi | |
| node trusted/scripts/check-contribution-scope.mjs "${args[@]}" | |
| - name: Enforce Demo lifecycle changes with trusted tooling | |
| if: ${{ github.event.pull_request.head.repo.full_name != github.repository || !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node trusted/scripts/check-demo-changes.mjs --base trusted --candidate submission --files changed-files.txt | |
| - name: Validate Demo source as data with trusted tooling | |
| if: ${{ github.event.pull_request.head.repo.full_name != github.repository || !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node trusted/scripts/validate-demos.mjs --root submission | |
| - name: Enforce stable published slugs | |
| run: node trusted/scripts/check-stable-slugs.mjs --base trusted --candidate submission | |
| - name: Test trusted tooling | |
| working-directory: trusted | |
| run: npm test | |
| - name: Validate content contribution with trusted tooling | |
| if: ${{ github.event.pull_request.head.repo.full_name != github.repository || !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node trusted/scripts/validate.mjs --root submission --contract-root trusted | |
| - name: Build content contribution catalog with trusted tooling | |
| if: ${{ github.event.pull_request.head.repo.full_name != github.repository || !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node trusted/scripts/build-catalog.mjs --root submission --contract-root trusted --out-dir artifacts/catalog --source-commit "$MERGE_SHA" | |
| - name: Install proposed dependencies | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| working-directory: submission | |
| run: npm ci --ignore-scripts | |
| - name: Enforce Demo lifecycle changes with proposed tooling | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node submission/scripts/check-demo-changes.mjs --base trusted --candidate submission --files changed-files.txt | |
| - name: Validate Demo source as data with proposed tooling | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node submission/scripts/validate-demos.mjs --root submission | |
| - name: Check proposed infrastructure | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| working-directory: submission | |
| run: npm run check | |
| - name: Build catalog with proposed infrastructure | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | |
| run: node submission/scripts/build-catalog.mjs --root submission --contract-root submission --out-dir artifacts/catalog --source-commit "$MERGE_SHA" | |
| - name: Upload catalog artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | |
| with: | |
| name: cookbook-catalog-${{ github.event.pull_request.number }} | |
| path: artifacts/catalog | |
| retention-days: 3 | |
| if-no-files-found: error |