feat: add TS rule no-non-null-asserted-nullish-coalescing
#247
Workflow file for this run
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: Checks | |
on: | |
pull_request: | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create GitHub App Token | |
uses: actions/create-github-app-token@v2 | |
continue-on-error: true | |
id: app-token | |
with: | |
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | |
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | |
- name: Check if commits can be added | |
id: check_can_add_commit | |
run: | | |
echo "can_add_commit=${{ steps.app-token.outputs.token != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT | |
- name: Checkout for pull request | |
if: steps.check_can_add_commit.outputs.can_add_commit == 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Checkout | |
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' | |
uses: actions/checkout@v4 | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
- name: Format | |
run: npm run format | |
- name: Check for Changes | |
id: check_changes | |
run: | | |
if [[ -n "$(git status --porcelain)" ]]; then | |
echo "changes_detected=true" >> $GITHUB_OUTPUT | |
else | |
echo "changes_detected=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit format | |
if: steps.check_changes.outputs.changes_detected == 'true' | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: . | |
default_author: github_actions | |
message: "🤖 Apply formatting changes" | |
- name: Fail for formatting issues without personal access token | |
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_changes.outputs.changes_detected == 'true' | |
run: | | |
echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available or this isn't a pull request." | |
exit 1 | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
- name: Lint | |
run: npm run lint -- --max-warnings 0 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
- name: Test | |
run: npm run test | |
may-merge: | |
needs: ["format", "lint", "test"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cleared for merging | |
run: echo OK |