-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Lint Dockerfile | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
# cSpell: ignore hadolint .devcontainer sarif codeql | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Hadolint | ||
run: sudo wget -O /bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.8.0/hadolint-Linux-x86_64 && sudo chmod +x /bin/hadolint | ||
|
||
- name: Create testResults directory | ||
run: mkdir -p testResults | ||
|
||
- name: Lint Dockerfile | ||
run: hadolint .devcontainer/Dockerfile --failure-threshold warning --format sarif > testResults/hadolint-results.sarif | ||
continue-on-error: true | ||
|
||
- name: Check if SARIF file exists | ||
id: check_sarif | ||
run: | | ||
if [ -f testResults/hadolint-results.sarif ]; then | ||
echo "file_exists=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "file_exists=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v3 | ||
if: always() && steps.check_sarif.outputs.file_exists == 'true' | ||
with: | ||
sarif_file: testResults/hadolint-results.sarif | ||
|
||
- name: Upload testResults | ||
uses: actions/upload-artifact@v2 | ||
if: always() && steps.check_sarif.outputs.file_exists == 'true' | ||
with: | ||
name: hadolint-results | ||
path: testResults/hadolint-results.sarif |