Skip to content

Commit

Permalink
chore: use global workflow for lint (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi authored Sep 20, 2024
1 parent cb474f4 commit 24fedf5
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 79 deletions.
85 changes: 43 additions & 42 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
---
name: Check external links

on:
push:
workflow_dispatch:
schedule:
- cron: "0 3 1 * *"
pull_request:
paths:
- .github/workflows/links.yml
push:
workflow_dispatch:
schedule:
- cron: 0 3 1 * *
pull_request:
paths:
- .github/workflows/links.yml

jobs:
lint:
name: links-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
lint:
name: links-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Get Current Timestamp
id: timestamp
run: echo "TIMESTAMP=$(date +%s)" >> "$GITHUB_ENV"
- name: Get Current Timestamp
id: timestamp
run: echo "TIMESTAMP=$(date +%s)" >> "$GITHUB_ENV"

- name: Restore lychee cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
path: .lycheecache
key: "cache-lychee-${{ env.TIMESTAMP }}"
restore-keys: cache-lychee-
- name: Restore lychee cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
path: .lycheecache
key: cache-lychee-${{ env.TIMESTAMP }}
restore-keys: cache-lychee-

- name: Link Checker
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1.10.0
with:
fail: true
args: -c ./lychee-links.toml --base . --cache --max-cache-age 1d . --verbose --no-progress '*.md' './**/*.md'
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Link Checker
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1.10.0
with:
fail: true
args: -c ./lychee-links.toml --base . --cache --max-cache-age 1d . --verbose --no-progress '*.md' './**/*.md'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create Issue From File
if: failure() && github.event_name == 'schedule'
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94 # v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue
- name: Create Issue From File
if: failure() && github.event_name == 'schedule'
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94 # v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue

- name: Notify in Slack in case of failure
id: slack-notification
if: failure() && github.event_name == 'schedule'
uses: camunda/infraex-common-config/.github/actions/report-failure-on-slack@077c725d621cb6061330b816b970a18dcfb4b3f4 # main
with:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
- name: Notify in Slack in case of failure
id: slack-notification
if: failure() && github.event_name == 'schedule'
uses: camunda/infraex-common-config/.github/actions/report-failure-on-slack@077c725d621cb6061330b816b970a18dcfb4b3f4 # main
with:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
14 changes: 5 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
---
# desc: lint sanity check
name: lint

on:
push:
workflow_dispatch:

pull_request:
push:
branches: [main]

jobs:
lint:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
uses: camunda/infraex-common-config/.github/workflows/lint-global.yml@029c5179173d1a31561827c078cdc2dee9faf8db # 1.1.0
secrets: inherit
66 changes: 38 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-symlinks
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-symlinks
- id: check-shebang-scripts-are-executable
- id: detect-private-key

- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint-docker
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint-docker

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 38.80.0
hooks:
- id: renovate-config-validator
args: ["--strict"]
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 38.80.0
hooks:
- id: renovate-config-validator
args: [--strict]

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: ["--strict" , "--force-scope"]
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [--strict, --force-scope]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567
hooks:
- id: shellcheck
...
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567
hooks:
- id: shellcheck

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: [-c, .yamllint.yaml]

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
17 changes: 17 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
extends: default

rules:
document-start:
level: error
comments:
level: error
min-spaces-from-content: 1
comments-indentation:
level: error
line-length:
max: 175
truthy:
# prevent false positives on Github Actions workflow files with `on`,
# see https://github.com/adrienverge/yamllint/issues/158
check-keys: false

0 comments on commit 24fedf5

Please sign in to comment.