lint-command #321
This file contains 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: "Slash Commands" | |
on: | |
issue_comment: | |
types: [created] | |
repository_dispatch: | |
types: [lint-command] | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
slash_command_dispatch: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'issue_comment' }} | |
steps: | |
- name: Slash Command Dispatch | |
uses: peter-evans/slash-command-dispatch@v4 | |
with: | |
token: ${{ secrets.REPO_ADMIN_TOKEN }} | |
commands: | | |
lint | |
lint-command: | |
runs-on: ubuntu-latest | |
concurrency: | |
# Run only a single lint command per PR | |
group: | |
"${{ github.workflow }} @ ${{ github.event.client_payload.pull_request.head.ref }}" | |
cancel-in-progress: true | |
if: | |
${{ github.event_name == 'repository_dispatch' && github.event.action == | |
'lint-command' }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_ADMIN_TOKEN }} | |
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.client_payload.pull_request.head.ref }} | |
- name: "Setup Node.js" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: ./package.json | |
- name: "Build the lint config and run lint" | |
# Note we ignore build failures. In most cases, the eslint-config package will still build. | |
# So we can at least attempt to fix some lint issues. | |
run: | | |
npm install | |
npm run build:ws || true | |
npm run lint:ws | |
- name: "Check for changed files" | |
uses: tj-actions/verify-changed-files@v20 | |
id: changed-files | |
- name: "Commit changes" | |
if: ${{ steps.changed-files.outputs.files_changed == 'true' }} | |
run: | | |
git config --global user.name 'actions-bot' | |
git config --global user.email '[email protected]' | |
git commit -am "chore: lint fixes" | |
git push |