-
Notifications
You must be signed in to change notification settings - Fork 113
53 lines (45 loc) · 1.88 KB
/
add-markdown-feedback.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
name: 'Add Markdown Feedback'
on:
pull_request:
paths: ['documentation/**.md']
branches: ['main']
permissions:
pull-requests: read
jobs:
add-markdown-feedback:
if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
name: 'Add Markdown Feedback'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
- name: Get base commit for the PR
run: |
git fetch origin "$GITHUB_BASE_REF"
base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF")
echo "base_sha=$base_sha" >> $GITHUB_ENV
echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}"
- name: Get changed files
run: |
changed_source_files=$(git diff-tree --no-commit-id --name-only --diff-filter=d -r "$base_sha" "$GITHUB_SHA" -- documentation ':!documentation/releaseNotes/*' | { grep "**.md$" || test $? = 1; })
echo "Files to validate: '${changed_source_files}'"
changed_source_files=$(echo "$changed_source_files" | xargs | sed 's/ documentation/,documentation/g')
echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV
- name: Append To File
uses: ./.github/actions/AppendToFile
with:
textToSearch: 'DGDQWXH'
textToAdd: '### Was this documentation helpful? [Share feedback](https://www.research.net/r/DGDQWXH?src={insertFileName})'
paths: ${{ env.updated_files }}
- name: Generate artifacts
run: |
mkdir -p ./pr
cp "$GITHUB_EVENT_PATH" ./pr/pr-event.json
git diff > ./pr/linter.diff
- name: Upload artifacts
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
with:
name: pr-linter
path: pr/