Skip to content

Commit

Permalink
ci(workflow/strict-check): add workflow to check new errors (#1324)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Maurer <[email protected]>
  • Loading branch information
danielleroux and nuke-ellington authored Jun 24, 2024
1 parent 47d2fe9 commit 9ef6dac
Show file tree
Hide file tree
Showing 6 changed files with 23,213 additions and 32 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/strict-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Strict check

on:
pull_request_target:
branches:
- '**'

# Check is not necessary after strict is true IX-1332
jobs:
strict_check:
permissions:
contents: read
pull-requests: write
strategy:
matrix:
branch: ['main', 'pr']
name: 'Get strictNullChecks errors on ${{ matrix.branch }}'
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
if: ${{ matrix.branch == 'main' }}

- name: Checkout PR branch
uses: actions/checkout@v4 # v4.1.6
with:
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
persist-credentials: false
if: ${{ matrix.branch == 'pr' }}

- uses: ./.github/workflows/actions/turbo

- name: Install tsc-output-parser
run: |
ROOT=$(pwd)
npm install -g @aivenio/[email protected]
cd ./packages/core
npx tsc --strictNullChecks --strictPropertyInitialization --noEmit --pretty false | npx tsc-output-parser > $ROOT/strict_${{ matrix.branch }}.json
cd $ROOT
- name: Upload strict_${{ matrix.branch }}.json
uses: actions/upload-artifact@v4
with:
name: strict_${{ matrix.branch }}
path: 'strict_${{ matrix.branch }}.json'

comment_on_pr:
permissions:
contents: read
pull-requests: write
needs: ['strict_check']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
persist-credentials: false

- uses: ./.github/workflows/actions/turbo

- name: Download strict error json for main branch
uses: actions/download-artifact@v4
with:
name: strict_main

- name: Download strict error json for pr branch
uses: actions/download-artifact@v4
with:
name: strict_pr

- name: Set comment body
id: report-body
run: pnpm ts-run scripts/strict-check.ts

- name: Find Comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '### Report of `strictNullChecks (strictPropertyInitialization)` check'

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.report-body.outputs.body }}
edit-mode: replace
Loading

0 comments on commit 9ef6dac

Please sign in to comment.