chore: add JetBrains auto-approval compliance linter #1
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: JetBrains Auto-Approval Compliance | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
compliance-check: | |
runs-on: ubuntu-latest | |
name: JetBrains Compliance Linting | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Make scripts executable | |
run: chmod +x ./scripts/jetbrains-compliance-check.sh | |
- name: Run JetBrains Compliance Checks | |
run: | | |
echo "Running JetBrains auto-approval compliance checks..." | |
./scripts/jetbrains-compliance-check.sh | |
- name: Comment PR with compliance status | |
if: github.event_name == 'pull_request' && failure() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '⚠️ **JetBrains Auto-Approval Compliance Check Failed**\n\n' + | |
'This PR contains code that violates JetBrains auto-approval requirements:\n\n' + | |
'- ❌ Do **not** use forbidden Kotlin experimental APIs\n' + | |
'- ❌ Do **not** add lambdas, handlers, or class handles to Java runtime hooks\n' + | |
'- ❌ Do **not** create threads manually (use coroutines or ensure cleanup in `CoderRemoteProvider#close()`)\n' + | |
'- ❌ Do **not** bundle libraries already provided by Toolbox\n' + | |
'- ❌ Do **not** perform ill-intentioned actions\n\n' + | |
'Please check the workflow logs for detailed violations and fix them before merging.' | |
}) |