Update 6-Appendix: Leveraging Dev Tools - Encoding and Decoding(#1070) #1778
Workflow file for this run
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: Markdown Lint Check | |
on: | |
pull_request_target: | |
branches: | |
- master | |
paths: | |
- '**.md' | |
- '!.github/**' | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: npm install -g markdownlint-cli | |
- name: Run linter | |
run: markdownlint . --config .github/configs/.markdownlint.json --ignore node_modules --ignore .github &> lint.txt | |
- name: Show Linting Issues | |
if: failure() | |
run: | | |
cat lint.txt | |
sed -i 's/```/triple-backtick/g' lint.txt | |
- name: Attach Linting Issues | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Linting Issues | |
path: lint.txt | |
- name: Comment Linting Issues | |
if: failure() | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require("fs"); | |
const lintPath = `${process.env.GITHUB_WORKSPACE}/lint.txt`; | |
const lintString = fs.readFileSync(lintPath).toString().trimEnd(); | |
github.rest.issues.createComment({ | |
issue_number: ${{ github.event.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `**The following issues were identified:** \n${lintString}` | |
}) | |