Snyk fixes and code quality fixes #7
Workflow file for this run
This file contains hidden or 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
name: Checks the security policy and configurations | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
security-policy: | |
if: github.event.repository.visibility == 'public' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@master | |
- name: Checks for SECURITY.md policy file | |
run: | | |
if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi | |
security-license: | |
if: github.event.repository.visibility == 'public' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@master | |
- name: Checks for License file | |
run: | | |
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt") | |
license_file_found=false | |
current_year=$(date +"%Y") | |
for license_file in "${expected_license_files[@]}"; do | |
if [ -f "$license_file" ]; then | |
license_file_found=true | |
# check the license file for the current year, if not exists, exit with error | |
if ! grep -q "$current_year" "$license_file"; then | |
echo "License file $license_file does not contain the current year." | |
exit 2 | |
fi | |
break | |
fi | |
done | |
if [ "$license_file_found" = false ]; then | |
echo "No license file found. Please add a license file to the repository." | |
exit 1 | |
fi |