|
| 1 | +--- |
| 2 | + |
| 3 | +name: 'MkDocs' |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: {} |
| 7 | + |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + lint: |
| 12 | + name: 'Lint' |
| 13 | + if: ${{ github.event_name == 'pull_request' }} |
| 14 | + env: |
| 15 | + MDLINT_PATHS: '"docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template"' |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + |
| 19 | + - name: Checkout Code |
| 20 | + uses: http://${{ secrets.ACTIONS_TOKEN_RO }}@gitea-http.git.svc:3000/actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Init Git Submodules |
| 23 | + shell: bash |
| 24 | + run: | |
| 25 | + git submodule update --init; |
| 26 | + git submodule foreach git submodule update --init; |
| 27 | +
|
| 28 | + ls -ls |
| 29 | +
|
| 30 | + - name: Install Dependencies |
| 31 | + shell: bash |
| 32 | + run: | |
| 33 | + sudo apt update; |
| 34 | + sudo apt install -y --no-install-recommends npm; |
| 35 | +
|
| 36 | + - name: Install Linter |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + npm install markdownlint-cli2@v0.18.1 --global; |
| 40 | + npm install markdownlint-cli2-formatter-junit --global; |
| 41 | + npm install markdownlint-cli2-formatter-template --global; |
| 42 | +
|
| 43 | + - name: Create Artifact directory |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + mkdir -p artifacts |
| 47 | +
|
| 48 | +
|
| 49 | + - name: Enable Problem Matcher |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + echo "NFC_PROBLEM_MATCHER=${GITHUB_REF_NAME}"; |
| 53 | + echo "NFC_PROBLEM_MATCHER_TYPE=markdown-lint"; |
| 54 | +
|
| 55 | +
|
| 56 | + - name: Lint |
| 57 | + id: lint |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + markdownlint-cli2 $MDLINT_PATHS 1>&1 || EXITCODE=$? |
| 61 | +
|
| 62 | + if [ "${EXITCODE}" ]; then |
| 63 | +
|
| 64 | + echo "exit_code=${EXITCODE}" >> $GITHUB_OUTPUT |
| 65 | +
|
| 66 | + else |
| 67 | +
|
| 68 | + echo "exit_code=0" >> $GITHUB_OUTPUT |
| 69 | +
|
| 70 | + fi |
| 71 | +
|
| 72 | + echo "[Trace] GITHUB_OUTPUT[$(cat $GITHUB_OUTPUT)]"; |
| 73 | +
|
| 74 | + ls -la; |
| 75 | + |
| 76 | + mv -vf markdown.junit.xml "artifacts/markdown_lint.junit.xml" |
| 77 | +
|
| 78 | + - name: debug ls |
| 79 | + if: ${{ success() || failure() }} |
| 80 | + shell: bash |
| 81 | + run: | |
| 82 | + ls -la artifacts/; |
| 83 | +
|
| 84 | +
|
| 85 | + - name: Check if Linting Error Occured |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + if [ ${{ steps.lint.outputs.exit_code }} -ge 3 ]; then |
| 89 | +
|
| 90 | + echo "[Error] ansible lint failed with ${{ steps.lint.outputs.exit_code }}"; |
| 91 | + |
| 92 | + exit ${{ steps.lint.outputs.exit_code }}; |
| 93 | +
|
| 94 | + fi # don't fail the job?? 1=failed test, 2=failed command i.e. switch/flag |
| 95 | +
|
| 96 | + - name: Upload build Artifact |
| 97 | + if: ${{ success() || failure() }} |
| 98 | + uses: http://${{ secrets.ACTIONS_TOKEN_RO }}@gitea-http.git.svc:3000/actions/upload-artifact@v3 |
| 99 | + with: |
| 100 | + name: mkdocs-lint |
| 101 | + path: artifacts/ |
0 commit comments