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
name: CI Workflow | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "app/data/repository/repository-info.json" | |
- "report.txt" | |
jobs: | |
lint_check_links: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: | | |
npm install | |
npm install linkinator | |
npm install @linthtml/linthtml --save-dev | |
npm install stylelint --save-dev | |
echo 'y' | npm init stylelint | |
- name: Display permissions | |
run: ls -la | |
- name: Run linters | |
id: lint | |
run: | | |
npx linkinator . -r 2>&1 | tee -a link-results.txt | |
npx stylelint "**/*.css" --formatter verbose 2>&1 | tee -a stylelint-results.txt | |
- name: Generate report | |
run: | | |
echo "# Ссылки" > report.txt | |
cat link-results.txt >> report.txt | |
echo "# Линтинг" >> report.txt | |
echo "## HTML" >> report.txt | |
cat htmlhint-results.txt >> report.txt | |
echo "## CSS" >> report.txt | |
cat stylelint-results.txt >> report.txt | |
- name: Check for changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add report.txt | |
if git diff --cached --quiet; then | |
echo "No changes detected, skipping commit and push." | |
exit 0 | |
fi | |
- name: Commit and push changes | |
env: | |
GITHUB_REPOSITORY: ${{ secrets.SUPER_SECRET }} | |
run: | | |
git pull origin main --ff-only | |
git commit -m "Add CI report" | |
git push origin HEAD:${{ github.ref }} |