Skip to content

chore: move toggle func to store #195

chore: move toggle func to store

chore: move toggle func to store #195

Workflow file for this run

name: Validate tag values in project MD files
# This workflow is triggered on PRs to main branch on the repository
on:
pull_request_target:
branches: main
jobs:
validate-content:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout PR
if: ${{ github.event.pull_request.number }}
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v44
with:
files: |
**.md
**.mdx
files_ignore: |
_project-template.md
tagsList.md
README.md
CONTRIBUTING.md
LICENSE-3-clause-BSD.md
LICENSE-MIT.md
- name: List all changed files markdown files
if: steps.changed-markdown-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- name: Setup node
if: steps.changed-markdown-files.outputs.any_changed == 'true'
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install npm dependencies
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: npm ci
working-directory: .github/actions
- name: Lint MD frontmatter for changed files
id: lint-md
if: steps.changed-markdown-files.outputs.any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: node .github/actions/validate-tags.js
- name: Check if validation report exists
id: check-report
run: |
if [ -f validation-report.md ]; then
echo "report-exists=true" >> $GITHUB_OUTPUT
else
echo "report-exists=false" >> $GITHUB_OUTPUT
fi
- name: Comment PR with validation report
if: steps.check-report.outputs.report-exists == 'true'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: validation-report.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail if validation report exists
run: |
if [ -f validation-report.md ]; then
echo "Validation report found, indicating issues. Failing the check..."
exit 1
else
echo "No validation report found. Proceeding..."
fi
- name: If no validation report, leave thank you
if: steps.check-report.outputs.report-exists == 'false'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## :tada: Thank you for your contribution!
The website maintainers will review your PR soon.
comment_tag: success