Last active
April 6, 2023 16:12
-
-
Save kjlape/eaa205794442c4b2149bc7b7f0295cb8 to your computer and use it in GitHub Desktop.
GitHub action to create linter fix PRs against your PRs
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: lint | |
on: | |
pull_request: | |
push: | |
branches: [ master ] | |
jobs: | |
lint-js: | |
if: ${{ !startsWith(github.head_ref, 'dependabot/') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .node-version | |
cache: yarn | |
- run: yarn install --immutable --immutable-cache | |
- name: Lint | |
run: | | |
yarn standard --fix | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
title: "[lint] Fix JS in #${{ github.event.pull_request.number }}" | |
base: ${{ github.head_ref }} | |
branch: ci-lint/js/${{ github.ref_name }} | |
body: | | |
Here are some helpful linter fixes for your javascript code in #${{ github.event.pull_request.number }} | |
lint-ruby: | |
if: ${{ !startsWith(github.head_ref, 'dependabot/') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Lint | |
run: | | |
bin/standardrb --fix | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
title: "[lint] Fix Ruby in #${{ github.event.pull_request.number }}" | |
base: ${{ github.head_ref }} | |
branch: ci-lint/ruby/${{ github.ref_name }} | |
body: | | |
Here are some helpful linter fixes for your ruby code in #${{ github.event.pull_request.number }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment