#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Auto-delete CI linting comments on success (#6465)
James Brunton61ebe977d37f
diff --git a/.github/workflows/ai-engine.yml b/.github/workflows/ai-engine.ymlindex e542d1effa..9c701a5a61 100644--- a/.github/workflows/ai-engine.yml+++ b/.github/workflows/ai-engine.yml@@ -1,8 +1,9 @@name: AI Engine CI-# Validates the Python AI engine: regenerates tool models, runs fixers,-# lint, type-check, and tests. Called from build.yml on PRs and merge_group;-# also runs directly on push to main as a post-merge safety net.+# Validates the Python AI engine: regenerates tool models and runs the+# engine quality gate (lint, type-check, format-check, tests). Called from+# build.yml on PRs and merge_group; also runs directly on push to main as+# a post-merge safety net.on:workflow_call:push:@@ -51,27 +52,95 @@ jobs:run: task engine:tool-models- name: Verify tool models are up to date- run: |- if ! git diff --exit-code engine/src/stirling/models/tool_models.py; then- echo "tool_models.py is out of date."- echo "Run 'task engine:tool-models' locally and commit the updated file."- exit 1- fi+ id: tool-models-check+ continue-on-error: true+ run: git diff --exit-code engine/src/stirling/models/tool_models.py- - name: Run fixers- run: task engine:fix+ - name: Comment on tool models check failure+ # Only post a comment on PRs. github-script's PR helpers need an+ # issue/PR number, which doesn't exist on merge_group runs.+ if: steps.tool-models-check.outcome == 'failure' && github.event_name == 'pull_request'+ continue-on-error: true+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0+ with:+ script: |+ const marker = '<!-- tool-models-check -->';+ const body = [+ marker,+ '### Tool Models Check Failed',+ '',+ 'The generated `engine/src/stirling/models/tool_models.py` is out of date with the Java OpenAPI spec and will need to be regenerated before it can be merged in.',+ '',+ 'Run `task engine:tool-models` to regenerate, then commit the updated file.',+ ].join('\n');+ const { data: comments } = await github.rest.issues.listComments({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ });+ const existing = comments.find(c => c.body.includes(marker));+ if (existing) {+ await github.rest.issues.updateComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: existing.id,+ body,+ });+ } else {+ await github.rest.issues.createComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ body,+ });+ }- - name: Verify fixes are committed- id: fixer_changes+ - name: Fail if tool models check failed+ if: steps.tool-models-check.outcome == 'failure'run: |- if ! git diff --quiet; then- git --no-pager diff --stat- echo "::error::There are issues with your Python code that will need to be fixed before they can be merged in. Run 'task engine:fix' to auto-fix what can be fixed automatically, then run 'task engine:check' to see what still needs fixing manually."- exit 1- fi-- - name: Comment on fixer failures- if: steps.fixer_changes.outcome == 'failure' && github.event_name == 'pull_request'+ echo "============================================"+ echo " Tool Models Check Failed"+ echo "============================================"+ echo ""+ echo "The generated engine/src/stirling/models/tool_models.py"+ echo "is out of date with the Java OpenAPI spec and will"+ echo "need to be regenerated before it can be merged in."+ echo ""+ echo "Run 'task engine:tool-models' to regenerate, then"+ echo "commit the updated file."+ echo "============================================"+ exit 1++ - name: Remove tool models check comment on success+ if: steps.tool-models-check.outcome == 'success' && github.event_name == 'pull_request'+ continue-on-error: true+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0+ with:+ script: |+ const marker = '<!-- tool-models-check -->';+ const { data: comments } = await github.rest.issues.listComments({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ });+ const existing = comments.find(c => c.body.includes(marker));+ if (existing) {+ await github.rest.issues.deleteComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: existing.id,+ });+ }++ - name: Quality-check engine+ id: engine-check+ run: task engine:check+ continue-on-error: true++ - name: Comment on engine check failure+ # Only post a comment on PRs. github-script's PR helpers need an+ # issue/PR number, which doesn't exist on merge_group runs.+ if: steps.engine-check.outcome == 'failure' && github.event_name == 'pull_request'continue-on-error: trueuses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0with:@@ -107,11 +176,39 @@ jobs:});}- - name: Run linting- run: task engine:lint-- - name: Run type checking- run: task engine:typecheck-- - name: Run tests- run: task engine:test+ - name: Fail if engine check failed+ if: steps.engine-check.outcome == 'failure'+ run: |+ echo "============================================"+ echo " Engine Check Failed"+ echo "============================================"+ echo ""+ echo "There are issues with your Python code that"+ echo "will need to be fixed before they can be merged in."+ echo ""+ echo "Run 'task engine:fix' to auto-fix what can be"+ echo "fixed automatically, then run 'task engine:check'"+ echo "to see what still needs fixing manually."+ echo "============================================"+ exit 1++ - name: Remove engine check comment on success+ if: steps.engine-check.outcome == 'success' && github.event_name == 'pull_request'+ continue-on-error: true+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0+ with:+ script: |+ const marker = '<!-- engine-check -->';+ const { data: comments } = await github.rest.issues.listComments({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ });+ const existing = comments.find(c => c.body.includes(marker));+ if (existing) {+ await github.rest.issues.deleteComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: existing.id,+ });+ }diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.ymlindex 72cb4a3074..73871dd7c3 100644--- a/.github/workflows/backend-build.yml+++ b/.github/workflows/backend-build.yml@@ -67,7 +67,7 @@ jobs:MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}MAVEN_PUBLIC_URL: ${{ secrets.MAVEN_PUBLIC_URL }}- - name: Comment on Java formatting failure+ - name: Comment on backend format check failure# Only post a comment on PRs. github-script's PR helpers need an# issue/PR number, which doesn't exist on merge_group runs.if: steps.spotless-check.outcome == 'failure' && github.event_name == 'pull_request'@@ -78,15 +78,11 @@ jobs:const marker = '<!-- java-formatting-check -->';const body = [marker,- '### Java Formatting Check Failed',+ '### Backend Format Check Failed','',- 'Your code has formatting issues. Run the following command to fix them:',+ 'There are formatting issues in your Java code that will need to be fixed before they can be merged in.','',- '```bash',- 'task backend:format',- '```',- '',- 'Then commit and push the changes.',+ 'Run `task backend:format` to auto-fix, then commit and push the changes.',].join('\n');const { data: comments } = await github.rest.issues.listComments({owner: context.repo.owner,@@ -110,22 +106,43 @@ jobs:});}- - name: Fail if Java formatting issues found+ - name: Fail if backend format check failedif: steps.spotless-check.outcome == 'failure'run: |echo "============================================"- echo " Java Formatting Check Failed"+ echo " Backend Format Check Failed"echo "============================================"echo ""- echo "Your code has formatting issues."- echo "Run the following command to fix them:"- echo ""- echo " task backend:format"+ echo "There are formatting issues in your Java code"+ echo "that will need to be fixed before they can be"+ echo "merged in."echo ""- echo "Then commit and push the changes."+ echo "Run 'task backend:format' to auto-fix, then"+ echo "commit and push the changes."echo "============================================"exit 1+ - name: Remove backend format check comment on success+ if: steps.spotless-check.outcome == 'success' && github.event_name == 'pull_request'+ continue-on-error: true+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0+ with:+ script: |+ const marker = '<!-- java-formatting-check -->';+ const { data: comments } = await github.rest.issues.listComments({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ });+ const existing = comments.find(c => c.body.includes(marker));+ if (existing) {+ await github.rest.issues.deleteComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: existing.id,+ });+ }+- name: Build with Gradle and spring security ${{ matrix.spring-security }}run: task backend:build:cienv: