Skip to content

Commit

Permalink
feat(gh-actions): add mega-linter and remove old gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap committed Jan 6, 2023
1 parent 1de2d96 commit c869df3
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 147 deletions.
5 changes: 5 additions & 0 deletions .checkov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
skip-check:
# Ensure that HEALTHCHECK instructions have been added to container images
- CKV_DOCKER_2
# The build output cannot be affected by user parameters other than the build entry point and the top-level source location. GitHub Actions workflow_dispatch inputs MUST be empty
- CKV_GHA_7
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ contact_links:
about: Please ask questions about GitHub Actions here.
- name: GitHub Pages help
url: https://help.github.com/en/github/working-with-github-pages
about: GitHub Pages documentaion here.
about: GitHub Pages documentation here.
13 changes: 0 additions & 13 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
paths:
- Dockerfile
- .dockerignore
- .hadolint.yaml
- entrypoint.sh
- .github/workflows/docker-image.yml
push:
Expand All @@ -15,7 +14,6 @@ on:
paths:
- Dockerfile
- .dockerignore
- .hadolint.yaml
- entrypoint.sh
- .github/workflows/docker-image.yml

Expand All @@ -27,14 +25,3 @@ jobs:

- name: Build test
run: docker build . --file Dockerfile

hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: hadolint
uses: burdzwastaken/hadolint-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HADOLINT_ACTION_DOCKERFILE_FOLDER: .
65 changes: 0 additions & 65 deletions .github/workflows/linter.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
pull_request:
types: [opened, synchronize]
paths:
- '**.md'
- "**.md"
- .github/workflows/markdown.yml
- .markdownlint.yml
push:
branches:
- main
paths:
- '**.md'
- "**.md"
- .github/workflows/markdown.yml
- .markdownlint.yml

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: MegaLinter

on:
workflow_dispatch:
push:
branches-ignore:
- main

jobs:
build:
name: MegaLinter
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Extract commands from markdown files
run: |
set -euxo pipefail
echo '#!/usr/bin/env bash' > README.sh
find . -name '*.md' -print0 | while IFS= read -r -d '' FILE ; do
sed -n "/^\`\`\`\(bash\|shell\).*/,/^\`\`\`$/p" "${FILE}" \
| \
sed \
-e 's/^```\(bash\|shell\).*//' \
-e '/^```$/d' \
>> README.sh
done
chmod a+x README.sh
- name: MegaLinter
uses: megalinter/megalinter@v6.17.0
env:
BASH_SHFMT_ARGUMENTS: --indent 2 --space-redirects
DISABLE_LINTERS: SPELL_CSPELL
FORMATTERS_DISABLE_ERRORS: false
GITHUB_COMMENT_REPORTER: false
GITHUB_STATUS_REPORTER: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MARKDOWN_MARKDOWN_LINK_CHECK_FILTER_REGEX_EXCLUDE: tests
PRINT_ALPACA: false
SARIF_REPORTER: true
VALIDATE_ALL_CODEBASE: true
12 changes: 6 additions & 6 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on:
workflow_dispatch:
inputs:
dryRun:
type: choice
type: boolean
description: "Dry-Run"
default: "false"
options:
- true
- false
required: false
default: false
logLevel:
type: choice
description: "Log-Level"
required: false
default: "debug"
options:
- info
Expand All @@ -22,7 +21,8 @@ on:
branches:
- main
paths:
- ".github/renovate.json5"
- .github/workflows/renovate.yml
- .github/renovate.json5
schedule:
- cron: "0 0,2,4 * * 0"

Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/shellcheck.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/yamllint.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ RUN set -eux && \

COPY entrypoint.sh /entrypoint.sh

USER guest

WORKDIR /mnt
ENTRYPOINT [ "/entrypoint.sh" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
Variables used by `action-my-markdown-link-checker` GitHub Action:

| Variable | Default | Description |
| --------------- | ----------------------------------------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|-----------------|-----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `config_file` | `.mlc_config.json` (if exists) | [Config file](https://github.com/tcort/markdown-link-check#config-file-format) used by [markdown-link-check](https://github.com/tcort/markdown-link-check) |
| `debug` | (not defined) | Enable debug mode for the [entrypoint.sh](entrypoint.sh) script (`set -x`) and `--verbose` for [markdown-link-check](https://github.com/tcort/markdown-link-check) |
| `exclude` | (not defined) | Exclude files or directories - see the [--exclude parameter](https://github.com/sharkdp/fd#excluding-specific-files-or-directories) of [fd](https://github.com/sharkdp/fd) command |
Expand Down
24 changes: 12 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: 'My Markdown Link Checker'
description: 'Check markdown files for broken links'
author: 'ruzickap'
name: "My Markdown Link Checker"
description: "Check markdown files for broken links"
author: "ruzickap"
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
branding:
icon: 'list'
color: 'blue'
icon: "list"
color: "blue"
inputs:
config_file:
description: 'markdown-link-check config file'
description: "markdown-link-check config file"
debug:
description: 'Debug mode'
description: "Debug mode"
exclude:
description: 'Exclude files or directories'
description: "Exclude files or directories"
fd_cmd_params:
description: 'Command line parameters for fd command. "exclude" and "search_paths" parameters are ignored if this is set'
quiet:
description: 'Quiet mode for markdown-link-check'
description: "Quiet mode for markdown-link-check"
search_paths:
description: 'Set paths which should be recursively scanned for markdown files (*.md) and linted. By default all "*.md" files are checked'
verbose:
description: 'Verbose mode for markdown-link-check'
description: "Verbose mode for markdown-link-check"
1 change: 0 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export SEARCH_PATHS=${INPUT_SEARCH_PATHS:-}
# Debug variable - enable by setting non-empty value
export VERBOSE=${INPUT_VERBOSE:-}


print_error() {
echo -e "\e[31m*** ERROR: ${1}\e[m"
}
Expand Down

0 comments on commit c869df3

Please sign in to comment.