Skip to content

Add Recon Section for API Chapter #1361

Add Recon Section for API Chapter

Add Recon Section for API Chapter #1361

name: Markdown Terminology Lint Check
on:
pull_request:
branches:
- master
paths:
- '**.md'
- '!.github/**'
permissions:
contents: read
pull-requests: write
jobs:
textlint:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
path: pr
- name: Checkout Base
uses: actions/checkout@v4
with:
repository: OWASP/wstg
path: base
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: echo $PR_NUMBER > pr_number
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
npm install -g textlint
npm install -g textlint-rule-terminology
- name: Changed Files Exporter
id: files
uses: umani/changed-files@v4.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pattern: '^.*\.(md)$'
- name: Run textlint Check
env:
FILES: '${{ steps.files.outputs.files_updated }} ${{ steps.files.outputs.files_created }}'
run: |
touch log.txt
# All markdown files, excluding .github
# Use fix flag so that it goes through all files
for FILE in $FILES; do echo 'pr/'"$FILE" | grep -v \.github && textlint --config base/.github/configs/.textlintrc --fix --rule terminology 'pr/'"$FILE" | tee -a log.txt; done
if grep -q 'Incorrect usage' log.txt ; then exit 1 ; else echo -e \"No terminology issues found.\"; fi
- name: Show Mistakes
if: failure()
run: |
cat log.txt
cat log.txt | grep -v '✔ Fixed' | tr '✔' '✖' >mistakes.txt
- name: Create artifact for comment
if: failure()
run: |
echo "**The following mistakes were identified:**" > artifact.txt
# Copy to generic name for commenting
cat mistakes.txt | tee -a artifact.txt
- name: Upload list of mistakes
if: failure()
uses: actions/upload-artifact@v4
with:
name: artifact
path: |
artifact.txt
pr_number