Skip to content

Commit

Permalink
REWORK-FILE-FINDER
Browse files Browse the repository at this point in the history
  • Loading branch information
kayman-mk committed May 20, 2024
1 parent e6ae67a commit 2b9018d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 73 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/default_linter_callable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,79 @@ jobs:
renovate-config: ${{ steps.changes.outputs.renovate-config }}
renovate-config_files: ${{ steps.changes.outputs.renovate-config_files }}

find-changes-for-shell-output:
runs-on: ubuntu-latest
steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes-for-shell
with:
list-files: "shell"
filters: |
markdown:
- added|modified: '**/*.md'
workflow:
- added|modified:
- '.github/workflows/*.yml'
- '.github/workflows/*.yaml'
yaml:
- added|modified:
- '**/*.yaml'
- '**/*.yml'
outputs:
markdown: ${{ steps.changes-for-shell.outputs.markdown }}
markdown_files: ${{ steps.changes-for-shell.outputs.markdown_files }}
workflow: ${{ steps.changes-for-shell.outputs.workflow }}
workflow_files: ${{ steps.changes-for-shell.outputs.workflow_files }}
yaml: ${{ steps.changes-for-shell.outputs.yaml }}
yaml_files: ${{ steps.changes-for-shell.outputs.yaml_files }}

lint-markdown:
runs-on: ubuntu-latest
continue-on-error: true
if: needs.find-changes-for-shell-output.outputs.markdown == 'true'
needs: find-changes-for-shell-output
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Validate Markdown file
run: |
npm install -g markdownlint-cli
# do not check CHANGELOG.md, it is generated automatically
markdownlint -c .config/markdownlint.yml -i CHANGELOG.md ${{ needs.find-changes-for-shell-output.outputs.markdown_files }}
lint-workflow:
runs-on: ubuntu-latest
continue-on-error: true
needs: find-changes-for-shell-output
if: needs.find-changes-for-shell-output.outputs.workflow == 'true'
container:
image: rhysd/actionlint:1.7.0@sha256:5acca218639222e4afbc82fc6e9ef56cbe646ade3b07f3f5ec364b638258a244
options: --cpus 1 --user root
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Validate Github workflows
run: |
mkdir .git
actionlint -color ${{ needs.find-changes-for-shell-output.outputs.workflow_files }}
lint-yaml:
runs-on: ubuntu-latest
continue-on-error: true
needs: find-changes-for-shell-output
if: needs.find-changes-for-shell-output.outputs.yaml == 'true'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: yaml-lint
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
with:
config_file: .config/yamllint.yml
file_or_dir: ${{ needs.find-changes-for-shell-output.outputs.yaml_files }}
strict: true

lint-json:
runs-on: ubuntu-latest
continue-on-error: true
Expand Down
73 changes: 0 additions & 73 deletions .github/workflows/this_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,76 +9,3 @@ jobs:
default:
uses: Hapag-Lloyd/Workflow-Templates/.github/workflows/default_linter_callable.yml@main
secrets: inherit

find-changes-for-shell-output:
runs-on: ubuntu-latest
steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes-for-shell
with:
list-files: "shell"
filters: |
markdown:
- added|modified: '**/*.md'
workflow:
- added|modified:
- '.github/workflows/*.yml'
- '.github/workflows/*.yaml'
yaml:
- added|modified:
- '**/*.yaml'
- '**/*.yml'
outputs:
markdown: ${{ steps.changes-for-shell.outputs.markdown }}
markdown_files: ${{ steps.changes-for-shell.outputs.markdown_files }}
workflow: ${{ steps.changes-for-shell.outputs.workflow }}
workflow_files: ${{ steps.changes-for-shell.outputs.workflow_files }}
yaml: ${{ steps.changes-for-shell.outputs.yaml }}
yaml_files: ${{ steps.changes-for-shell.outputs.yaml_files }}

lint-markdown:
runs-on: ubuntu-latest
continue-on-error: true
if: needs.find-changes-for-shell-output.outputs.markdown == 'true'
needs: find-changes-for-shell-output
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Validate Markdown file
run: |
npm install -g markdownlint-cli
# do not check CHANGELOG.md, it is generated automatically
markdownlint -c .config/markdownlint.yml -i CHANGELOG.md ${{ needs.find-changes-for-shell-output.outputs.markdown_files }}
lint-workflow:
runs-on: ubuntu-latest
continue-on-error: true
needs: find-changes-for-shell-output
if: needs.find-changes-for-shell-output.outputs.workflow == 'true'
container:
image: rhysd/actionlint:1.7.0@sha256:5acca218639222e4afbc82fc6e9ef56cbe646ade3b07f3f5ec364b638258a244
options: --cpus 1 --user root
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Validate Github workflows
run: |
mkdir .git
actionlint -color ${{ needs.find-changes-for-shell-output.outputs.workflow_files }}
lint-yaml:
runs-on: ubuntu-latest
continue-on-error: true
needs: find-changes-for-shell-output
if: needs.find-changes-for-shell-output.outputs.yaml == 'true'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: yaml-lint
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
with:
config_file: .config/yamllint.yml
file_or_dir: ${{ needs.find-changes-for-shell-output.outputs.yaml_files }}
strict: true

0 comments on commit 2b9018d

Please sign in to comment.