Skip to content

EDU-13931 - Release note: Rename 'faststore.config' file to 'discovery.config' #352

EDU-13931 - Release note: Rename 'faststore.config' file to 'discovery.config'

EDU-13931 - Release note: Rename 'faststore.config' file to 'discovery.config' #352

name: Check VTEX Styleguide
on:
pull_request:
types: [opened, synchronize]
jobs:
check-vtex-styleguide:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure all branches are accessible
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
# Step 3: Install necessary dependencies
- name: Install dependencies
run: npm install @actions/core@1.10
- name: Install Reviewdog
uses: reviewdog/action-setup@v1
# Step 4: Get all changed markdown files
- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v45
with:
files: |
**.md
**.mdx
- name: List all changed files
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
# Step 5: Run style checker and output in Reviewdog format
- name: Collect messages from styleguide checker
id: collect-messages
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 "Running styleguide checker on $file"
node .github/scripts/check-styleguide.js "./$file" >> style_issues.txt
done
# Step 6: Run Reviewdog
- name: Run Reviewdog
if: steps.collect-messages.outputs.style-issues != ''
run: |
echo "Running Reviewdog with the following style issues:"
cat style_issues.txt
reviewdog -efm="%f:%l:%c:%m" -name="style-check" -reporter=github-pr-review < style_issues.txt
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}