Skip to content

Use lint action

Use lint action #1442

Workflow file for this run

name: Workspace
on:
push:
branches:
- main
pull_request:
jobs:
post-upgrade:
name: Renovate Post-Upgrade
runs-on: ubuntu-latest
if: ${{ github.actor == 'renovate[bot]' || github.actor == 'dependabot[bot]' }}
outputs:
has-changes: ${{ steps.git-changes.outputs.has-changes }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: langri-sha/github/actions/pnpm@v0.2.0
- name: Apply ESLint fixes
run: pnpm eslint --fix .
- name: Apply Prettier fixes
run: pnpm prettier --write .
- name: Update Vitest snapshots
run: pnpm vitest --update --passWithNoTests
- name: Apply projen changes
run: pnpx projen
- name: Create Beachball changes
run: |
pnpm beachball change \
--message "chore(deps): ${{ github.event.pull_request.title }}" \
--no-commit \
--type patch \
--yes
- name: Check for Git changes
id: git-changes
run: |
if [[ `git status --porcelain | wc -c` -ne '0' ]]; then
echo "has-changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Create patch
run: |
git add -A
git diff --cached > .diff.patch
- name: Upload diff
uses: actions/upload-artifact@v4
if: ${{ steps.git-changes.outputs.has-changes }}
with:
name: diff
path: .diff.patch
commit-upgrade-changes:
name: Commit Upgrade Changes
runs-on: ubuntu-latest
if: ${{ needs.post-upgrade.outputs.has-changes }}
needs: [post-upgrade]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Download diff
uses: actions/download-artifact@v4
with:
name: diff
- name: Configure Git user
uses: langri-sha/github/actions/github-action-bot-git-user@v0.2.0
- name: Apply diff
run: |
git apply .diff.patch
git add .
git commit -m "chore(deps): Apply upgrade changes"
git push origin ${{ github.event.pull_request.head.ref }}
lint:
name: Lint
runs-on: ubuntu-latest
needs: [commit-upgrade-changes]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup PNPM
uses: langri-sha/github/actions/pnpm@v0.2.0
- name: Lint
uses: langri-sha/github/actions/lint@d57a745632a8ed295e0d0ad10d1878a325de5c11
with:
beachball: true
eslint: true
packages: true
prettier: true
projen: true
typescript: true
- name: Prettier
run: pnpm prettier --check .
- name: TypeScript
run: pnpm tsc --build .
- name: Beachball
if: github.event_name == 'pull_request'
run: |
pnpm beachball check ||
(
echo "::error::Beachballchanges detected. Run 'pnpm beachball change' and commit the changes.";
exit 1
)
- name: Sort packages
run: |
pnpx sort-package-json --check \
./apps/*/package.json \
./packages/*/package.json \
package.json
- name: Check packages
run: |
pnpm -r exec npm pkg fix
if [[ $(git status --porcelain) ]]; then
echo '::error::Some packages need fixing.'
git status
git diff
exit 1
fi
- name: Check projen configuration
run: |
pnpx projen
if [[ $(git status --porcelain) ]]; then
echo '::error::Some projen changes haven not been appplied. Run `pnpx projen`.'
git status
git diff
exit 1
fi
vitest:
name: Vitest
runs-on: ubuntu-latest
needs: [commit-upgrade-changes]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: langri-sha/github/actions/pnpm@v0.2.0
- name: Vitest
run: pnpm vitest --passWithNoTests