[Ignore] Example PR for lint-action (flake8) with action-lint (eslint) #5
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: Lint | |
on: | |
pull_request: | |
branches: | |
- master | |
permissions: | |
checks: write | |
contents: write | |
env: | |
BRANCH_NAME: ${{ github.head_ref }} | |
BASE_NAME: ${{ github.base_ref }} | |
jobs: | |
lint-python: | |
name: Lint Python | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get changed python files between base and head | |
run: > | |
echo "CHANGED_FILES=$(echo $(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- | grep \.py))" >> $GITHUB_ENV | |
- name: Output changed python file | |
run: echo ${{ env.CHANGED_FILES }} | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
if: ${{ env.CHANGED_FILES }} | |
with: | |
python-version: 3.8 | |
- name: Install Python dependencies | |
if: ${{ env.CHANGED_FILES }} | |
run: pip install flake8 | |
- name: Run flake8 linter | |
if: ${{ env.CHANGED_FILES }} | |
uses: wearerequired/lint-action@v2 | |
with: | |
flake8: true | |
flake8_auto_fix: false | |
flake8_args: ${{ steps.python-files.outputs.python-file-names }} | |
# If this is in the same step as python linting the annotations don't show up...sad face | |
lint-javascript: | |
name: Lint Javascript | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
if: ${{ steps.javascript-files.outputs.javascript-file-present == 'true' }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Install Node.js dependencies | |
if: ${{ steps.javascript-files.outputs.javascript-file-present == 'true' }} | |
run: yarn install --frozen-lockfile | |
- uses: sibiraj-s/action-eslint@v2 | |
if: ${{ steps.javascript-files.outputs.javascript-file-present == 'true' }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
annotations: true |