chore(deps): bump mlua from 0.11.6 to 0.12.0 #1348
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: PR Validation | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| validate-pr-title: | |
| name: Validate PR Title | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR title format | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const title = context.payload.pull_request.title; | |
| const pr = context.payload.pull_request; | |
| // Conventional commit: type(optional-scope): description | |
| const pattern = /^(feat|fix|docs|style|refactor|perf|test|chore|ci|build)(\(.+\))?:/; | |
| const isValid = pattern.test(title.toLowerCase()); | |
| if (!isValid) { | |
| core.setFailed(`PR title must follow conventional commits: type(scope): description`); | |
| // Don't comment on bot PRs — they can't fix their titles | |
| const isBot = pr.user.type === 'Bot'; | |
| if (!isBot) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: `## Invalid PR Title | |
| Your PR title must follow conventional commits format: | |
| \`type(optional-scope): description\` | |
| Valid types: \`feat\`, \`fix\`, \`docs\`, \`style\`, \`refactor\`, \`perf\`, \`test\`, \`chore\`, \`ci\`, \`build\` | |
| Examples: | |
| - \`feat: add new sprite collision detection\` | |
| - \`fix(renderer): correct z-ordering for 2D sprites\` | |
| - \`chore(deps): bump serde from 1.0 to 1.1\` | |
| Please update your PR title and try again.` | |
| }); | |
| } | |
| } | |
| validate-release-config: | |
| name: Validate Release Config | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Validate release-please config | |
| run: | | |
| python3 -c " | |
| import json, sys | |
| with open('release-please-config.json') as f: | |
| config = json.load(f) | |
| with open('.release-please-manifest.json') as f: | |
| manifest = json.load(f) | |
| pkgs = config.get('packages', {}) | |
| if '.' not in pkgs: | |
| print('ERROR: No root package in release-please-config.json') | |
| sys.exit(1) | |
| if '.' not in manifest: | |
| print('ERROR: No root entry in .release-please-manifest.json') | |
| sys.exit(1) | |
| print(f'release-please config OK (version: {manifest[\".\"]}, type: {pkgs[\".\"].get(\"release-type\", \"unknown\")})') | |
| " | |
| - name: Validate version.txt | |
| run: | | |
| if [ ! -f version.txt ]; then | |
| echo "ERROR: version.txt missing (required by release-please simple type)" | |
| exit 1 | |
| fi | |
| VERSION=$(cat version.txt | tr -d '[:space:]') | |
| if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "ERROR: version.txt contains invalid version: $VERSION" | |
| exit 1 | |
| fi | |
| echo "version.txt OK: $VERSION" | |
| - name: Validate version consistency | |
| run: | | |
| VERSION=$(cat version.txt | tr -d '[:space:]') | |
| CARGO_VERSION=$(grep '^version = ' goud_engine/Cargo.toml | head -1 | cut -d'"' -f2) | |
| if [ "$VERSION" != "$CARGO_VERSION" ]; then | |
| echo "ERROR: version.txt ($VERSION) does not match goud_engine/Cargo.toml ($CARGO_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version consistency OK: $VERSION" | |
| check-file-size: | |
| name: Check File Sizes | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for large files | |
| run: | | |
| # Find files larger than 1MB | |
| LARGE_FILES=$(find . -type f -size +1M ! -path "./.git/*" ! -path "./target/*" ! -path "*/bin/*" ! -path "*/obj/*" ! -name "*.png" ! -name "*.jpg" ! -name "*.jpeg" ! -name "*.gif" ! -name "*.glb" ! -name "*.gltf" ! -name "*.fbx" ! -name "*.obj") | |
| if [ -n "$LARGE_FILES" ]; then | |
| echo "## ⚠️ Large files detected (>1MB):" >> $GITHUB_STEP_SUMMARY | |
| echo "$LARGE_FILES" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Consider using Git LFS for large binary files." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi | |
| check-rs-line-limit: | |
| name: Rust File Line Limit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Check .rs files do not exceed 500 lines | |
| run: | | |
| chmod +x scripts/check-rs-line-limit.sh | |
| scripts/check-rs-line-limit.sh --error | |
| check-ai-config: | |
| name: Validate AI Config Sync | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Unit-test the agent-config generator | |
| run: python3 scripts/test_sync_agent_configs.py | |
| - name: Verify generated agent wrappers are in sync | |
| run: | | |
| python3 scripts/sync-agent-configs.py --check | |
| bash scripts/validate-ai-config.sh | |
| check-todos: | |
| name: Check TODOs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for new TODOs | |
| run: | | |
| # Get the base branch | |
| BASE_BRANCH=${{ github.event.pull_request.base.ref }} | |
| git fetch origin $BASE_BRANCH | |
| # Find new TODOs in the PR | |
| NEW_TODOS=$(git diff origin/$BASE_BRANCH...HEAD | grep -E "^\+.*TODO" | grep -v "^+++" || true) | |
| if [ -n "$NEW_TODOS" ]; then | |
| echo "## 📝 New TODOs found in this PR:" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "$NEW_TODOS" | sed 's/^+//' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Consider creating GitHub issues for these TODOs." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| lint-markdown: | |
| name: Lint Markdown Files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Get changed markdown files | |
| id: changed | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only | grep '\.md$' || true) | |
| echo "files<<EOF" >> "$GITHUB_OUTPUT" | |
| echo "$FILES" >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| if [ -z "$FILES" ]; then | |
| echo "No markdown files changed in this PR" | |
| else | |
| echo "Changed markdown files:" | |
| echo "$FILES" | |
| fi | |
| - name: Lint changed Markdown files | |
| if: steps.changed.outputs.files != '' | |
| uses: DavidAnson/markdownlint-cli2-action@v23 | |
| with: | |
| globs: ${{ steps.changed.outputs.files }} | |
| pr-size-labeler: | |
| name: PR Size Labeler | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Add size labels | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number | |
| }); | |
| const additions = pr.additions; | |
| const deletions = pr.deletions; | |
| const total = additions + deletions; | |
| // Remove existing size labels | |
| const sizeLabels = ['size/XS', 'size/S', 'size/M', 'size/L', 'size/XL']; | |
| for (const label of sizeLabels) { | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| name: label | |
| }); | |
| } catch (e) { | |
| // Label might not exist, ignore | |
| } | |
| } | |
| // Add appropriate size label | |
| let sizeLabel; | |
| if (total < 10) sizeLabel = 'size/XS'; | |
| else if (total < 100) sizeLabel = 'size/S'; | |
| else if (total < 500) sizeLabel = 'size/M'; | |
| else if (total < 1000) sizeLabel = 'size/L'; | |
| else sizeLabel = 'size/XL'; | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| labels: [sizeLabel] | |
| }); | |
| // Add summary | |
| console.log(`PR size: +${additions} -${deletions} (total: ${total}) - Label: ${sizeLabel}`); | |
| - name: Enforce PR size limit | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number | |
| }); | |
| const total = pr.additions + pr.deletions; | |
| const changedFiles = pr.changed_files; | |
| const hasOverride = (pr.labels || []).some(l => l.name === 'size-override'); | |
| const oversized = total > 4000 || changedFiles > 100; | |
| if (oversized && !hasOverride) { | |
| core.setFailed( | |
| `PR is oversized: +${pr.additions} -${pr.deletions} (${total} changed lines) across ${changedFiles} files. ` + | |
| `Limits are 4000 changed lines or 100 changed files. ` + | |
| `Please split this PR into smaller, focused changes, or apply the 'size-override' label with a written justification if this size is unavoidable.` | |
| ); | |
| } else { | |
| console.log(`PR size within limits: ${total} changed lines across ${changedFiles} files (size-override present: ${hasOverride}).`); | |
| } | |
| secret-scan: | |
| name: Secret Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run gitleaks | |
| uses: gitleaks/gitleaks-action@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITLEAKS_ENABLE_UPLOAD_ARTIFACT: false | |
| validate-success: | |
| name: PR Validation Success | |
| needs: [validate-pr-title, validate-release-config, check-file-size, check-rs-line-limit, check-ai-config, check-todos, lint-markdown, pr-size-labeler, secret-scan] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check validation status | |
| run: | | |
| if [[ "${{ needs.validate-pr-title.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.validate-release-config.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.check-file-size.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.check-rs-line-limit.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.check-ai-config.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.secret-scan.result }}" == "failure" ]]; then | |
| echo "PR validation failed!" | |
| exit 1 | |
| fi | |
| echo "All PR validations passed!" |