-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
57 lines (57 loc) · 1.81 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
name: documentaly
author: mssknd
description: Check document maintenance
branding:
icon: file-text
color: orange
inputs:
BASE_BRANCH:
description: 'Base branch name (default: main)'
default: 'main'
MARKDOWN_DIR:
default: '*'
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: install documentaly
shell: bash
run: deno install -A --name documentaly https://deno.land/x/documentaly/mod.ts
- name: Fetch base branch
shell: bash
run: git fetch origin ${{ inputs.BASE_BRANCH }}:${{ inputs.BASE_BRANCH }}
- name: Check to maintain documents
# Give a list of modified files and markdowns.
shell: bash
run: >
documentaly check
$(git diff --name-only HEAD ${{ inputs.BASE_BRANCH }} | tr '\n' ' ')
-m $(find ${{ inputs.MARKDOWN_DIR }} -name '*.md' -type f | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/,/g' -e 's/,$//')
> ./dipendency.json
- name: Generate comment body file
shell: bash
env:
PR_HEAD_SHA: ${{github.event.pull_request.head.sha}}
PR_HEAD_FULL_NAME: ${{github.event.pull_request.head.repo.full_name}}
run: >
documentaly comment
-b ${PR_HEAD_FULL_NAME}
-s ${PR_HEAD_SHA}
-j "$( cat ./dipendency.json )"
> comment-body.md
- name: Check file size
shell: bash
run: |
file_size=$(stat -c%s comment-body.md)
echo "file_size=$file_size" >> $GITHUB_ENV
- name: Make comment on pull request when this action was pull request event.
if: env.file_size != '0'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: comment-body.md
comment_tag: documentaly-comment