chore(deps): update eslint #2664
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: Lint | |
on: | |
pull_request: | |
branches: [main] | |
paths: | |
- '**.md' | |
workflow_dispatch: | |
jobs: | |
suggestions: | |
runs-on: ubuntu-latest | |
if: '! github.event.pull_request.head.repo.fork' | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout SAP repo | |
run: | | |
git config --global credential.helper "cache --timeout=3600" | |
echo -e "url=https://user:${GH_TOKEN}@github.com\n" | git credential approve | |
echo -e "url=https://user:${GH_TOKEN_PARENT}@github.tools.sap\n" | git credential approve | |
git clone --depth 1 --no-single-branch https://github.tools.sap/cap/docs docs | |
cd docs | |
git checkout $GITHUB_HEAD_REF || git checkout main | |
git submodule update --init --recursive | |
cd @external | |
git checkout $GITHUB_HEAD_REF | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN_PARENT: ${{ secrets.GH_TOKEN_PARENT }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
cache-dependency-path: docs/package-lock.json | |
- run: npm ci | |
working-directory: docs | |
- run: git checkout ${{ github.head_ref }} | |
working-directory: docs/@external | |
- name: Get changes | |
id: changes | |
working-directory: docs/@external | |
run: | | |
echo "DIFF_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- '*.md' | xargs)" >> "$GITHUB_OUTPUT" | |
- name: Run cspell | |
if: steps.changes.outputs.DIFF_FILES != '' | |
id: cspell | |
continue-on-error: true | |
working-directory: docs/@external | |
run: | | |
npx cspell --no-progress --show-suggestions --show-context ${{ steps.changes.outputs.DIFF_FILES }} >> ${{ github.workspace }}/docs/@external/CSPELL.log | |
- name: Run markdownlint | |
if: steps.changes.outputs.DIFF_FILES != '' | |
id: markdownlint | |
continue-on-error: true | |
working-directory: docs/@external | |
run: | | |
npx markdownlint-cli --output ${{ github.workspace }}/docs/@external/MARKDOWNLINT.log -r markdownlint-rule-search-replace ${{ steps.changes.outputs.DIFF_FILES }} | |
- name: Create review | |
id: create_review | |
if: steps.cspell.outcome == 'failure' || steps.markdownlint.outcome == 'failure' | |
uses: actions/github-script@v6 | |
env: | |
SHA: ${{ github.event.pull_request.head.sha }} | |
BASE_DIR: ${{ github.workspace }}/docs/@external | |
BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
PULL_NUMBER: ${{ github.event.number }} | |
HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
REPO: 'docs' | |
REPO_OWNER: 'cap-js' | |
with: | |
script: | | |
const script = require('${{ github.workspace }}/docs/@external/.github/etc/create-review.cjs') | |
await script({github, context, core, require, exec}) |