Skip to content

Fix linter hints

Fix linter hints #2793

name: Fix linter hints
on:
schedule:
- cron: '0 */8 * * MON-FRI'
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@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
cache: maven
- name: Build with Maven
run: ./mvnw -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: |
/bin/sh ../.github/scripts/web-code-quality.sh | curl -X POST -H 'Content-Type: application/json' -d @- ${{ secrets.DEV_METRICS_URL }}
- name: Create/Update Pull Request
id: pr-create
uses: peter-evans/create-pull-request@b3a2c5d525a1eb75e75c781e45a1bf3bfc23bdc6
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 <garybot2@graylog.com>
branch: fix/linter-hints
committer: Dr. Lint-a-lot <garybot2@graylog.com>
commit-message: Running lint --fix
delete-branch: true
- name: Get headRef and SHA of PR
id: pr-infos
if: ${{ steps.pr-create.outputs.pull-request-number && steps.pr-create.outputs.pull-request-operation != 'closed' }}
run: |
HEADREF=$(gh pr view ${{ steps.pr-create.outputs.pull-request-number }} --json headRefName --template '{{.headRefName}}')
echo "sha=$(git rev-parse origin/$HEADREF)" >> $GITHUB_OUTPUT
echo "headref=$HEADREF" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
- name: Request dispatched PR build
if: ${{ steps.pr-create.outputs.pull-request-number && steps.pr-create.outputs.pull-request-operation != 'closed' }}
run: >
gh workflow run -R Graylog2/graylog-project-internal pr-build.yml --ref master
-f caller_repo=${{ github.repository }}
-f caller_pr_nr=${{ steps.pr-create.outputs.pull-request-number }}
-f caller_base_branch=master
-f caller_head_branch=${{ steps.pr-infos.outputs.headref }}
-f head_sha=${{ steps.pr-infos.outputs.sha }}
-f initial_actor="Dr. Lint-a-lot"
env:
GITHUB_TOKEN: ${{ secrets.PAT_GRAYLOG_PROJECT_INTERNAL_WORKFLOW_RW }}