Skip to content

Fix linter hints

Fix linter hints #1968

name: Fix linter hints
on:
schedule:
- cron: '0 */8 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
steps:
- name: Freeing up more disk space
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
cache: maven
- name: Set up Yarn cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-yarn-${{ hashFiles('graylog2-web-interface/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: ~/.cache/yarn
- name: Build with Maven
run: mvn -B --fail-fast -Pedantic -Dspotbugs.skip -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -DskipTests compile
env:
JAVA_OPTS: -Xmx6G
- name: Resetting lockfile
working-directory: graylog2-web-interface
run: git checkout yarn.lock
- name: Run lint --fix
continue-on-error: true
working-directory: graylog2-web-interface
run: yarn lint --fix -o /tmp/report.json -f json
- name: Run lint:styles --fix
continue-on-error: true
working-directory: graylog2-web-interface
run: yarn lint:styles --fix -o /tmp/report-stylelint.json -f json
- name: Submit Results
continue-on-error: true
working-directory: graylog2-web-interface
run: |
PROBLEM_COUNT=`jq '. | map(.errorCount + .warningCount)|add' /tmp/report.json`
PROBLEM_COUNT_STYLELINT=`jq '. | map(.warnings | length)|add' /tmp/report-stylelint.json`
CURRENT_REF=`git rev-parse HEAD`
TIMESTAMP=`git show --format=%at $CURRENT_REF|head -1`
PAYLOAD=$(cat <<- EOF
{
"version": "1.1",
"host": "developermetrics",
"job": "fix-linter-hints",
"short_message": "Found ${PROBLEM_COUNT} ESLint and ${PROBLEM_COUNT_STYLELINT} Stylelint problems in commit ${CURRENT_REF}",
"_problems": ${PROBLEM_COUNT},
"_problems_stylelint": ${PROBLEM_COUNT_STYLELINT},
"_current_ref": "${CURRENT_REF}",
"timestamp": ${TIMESTAMP}
}
EOF
)
curl -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" ${{ secrets.DEV_METRICS_URL }}
- name: Create/Update Pull Request
uses: Graylog2/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad
with:
title: Fixing linter hints automatically
body: This PR was created by a job that is running periodically to find and fix linter hints.
author: Dr. Lint-a-lot <[email protected]>
branch: fix/linter-hints
committer: Dr. Lint-a-lot <[email protected]>
commit-message: Running lint --fix
delete-branch: true