-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
63 lines (56 loc) · 1.95 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: 'Check Markdown'
description: 'Return errors found on a pull request with problems in .md and .ipynb files.'
author: "John Aziz"
branding:
color: "green"
icon: "check-circle"
inputs:
command:
description: The function to run and validate.
required: true
default: check-broken-paths
directory:
description: The directory that contains .md and .ipynb files.
required: true
default: ./
guide-url:
description: The contribution guide full URL.
required: true
default: 'https://github.com/john0isaac/action-check-markdown/blob/main/CONTRIBUTING.md'
github-token:
description: GitHub token
required: true
default: ''
runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install markdown-checker
shell: bash
- name: Generate Random File Name
run: echo "OUTPUT_FILE_NAME=$(echo $RANDOM$RANDOM)" >> $GITHUB_ENV
shell: bash
- name: Run markdown-checker
run: |
markdown-checker --dir ${{ inputs.directory }} --func ${{ inputs.command }} --guide-url ${{ inputs.guide-url }} --output-file-name ${{ env.OUTPUT_FILE_NAME }}
shell: bash
- name: Set job summary
if: ${{ always() && hashFiles(format('./{0}.md', env.OUTPUT_FILE_NAME)) != '' }}
shell: bash
run: cat ./${{ env.OUTPUT_FILE_NAME }}.md >> $GITHUB_STEP_SUMMARY
- name: Post comment
if: ${{ always() && hashFiles(format('./{0}.md', env.OUTPUT_FILE_NAME)) != '' }}
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: gh pr comment ${{ github.event.pull_request.html_url }} -F ./${{ env.OUTPUT_FILE_NAME }}.md
- name: Update workflow run status
if: ${{ always() && hashFiles(format('./{0}.md', env.OUTPUT_FILE_NAME)) != '' }}
shell: bash
run: exit 1