-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (38 loc) · 1.57 KB
/
external-urls.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
# This is a workflow to automatically convert external markdown links into HTML
name: Convert external URLs
on: [pull_request]
jobs:
convert-external-urls:
runs-on: ubuntu-latest
name: Convert external URLs
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v25
with:
files: |
content/**/*.md
api/**/*.md
sha: ${{ github.event.pull_request.head.sha }}
base_sha: ${{ github.event.pull_request.base.sha }}
- name: Pass filenames to steps.changed-files.outputs.all_changed_files
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "DOCS_PATHS=${{ steps.changed-files-specific.outputs. all_changed_files }}" >> $GITHUB_ENV
- name: Run URL replacer
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: python .github/external-link-replace.py
- name: Commit changes and push
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
if [[ `git status --porcelain` ]]; then
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "Automated external URL lint."
fi
git push