-
Notifications
You must be signed in to change notification settings - Fork 34.2k
170 lines (165 loc) · 6.19 KB
/
validate-markdown.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Validate Markdown
on:
# Trigger the workflow on pull request
pull_request_target:
branches:
- main
paths:
- '**.md'
- '**.ipynb'
permissions:
contents: read
id-token: write
issues: write
pull-requests: write
jobs:
check-broken-paths:
name: Check Broken Relative Paths
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check broken Paths
id: check-broken-paths
uses: john0isaac/[email protected]
with:
command: check-broken-paths
directory: ./
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Leave broken paths comment
if: ${{ steps.check-broken-paths.outputs.is-valid == 1 }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
We have automatically detected the following broken relative paths in your lessons.
Please check the file paths and associated broken paths inside them.
Learn more from our [contributing guide](https://github.com/microsoft/generative-ai-for-beginners/blob/main/CONTRIBUTING.md).
# Check Broken Paths
${{ env.BROKEN_PATHS }}
`
})
- name: Update workflow run status
if: ${{ steps.check-broken-paths.outputs.is-valid == 1 }}
run: exit 1
check-paths-tracking:
if: ${{ always() }}
needs: check-broken-paths
name: Check Paths Have Tracking
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run Check paths tracking
id: check-paths-tracking
uses: john0isaac/[email protected]
with:
command: check-paths-tracking
directory: ./
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Leave paths tracking comment
if: ${{ steps.check-paths-tracking.outputs.is-valid == 1 }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
We have automatically detected missing tracking id from the following relative paths in your lessons.
Please check the file paths and associated paths inside them.
Learn more from our [contributing guide](https://github.com/microsoft/generative-ai-for-beginners/blob/main/CONTRIBUTING.md).
# Check Missing Tracking from Paths
${{ env.PATHS_TRACKING }}
`
})
- name: Update workflow run status
if: ${{ steps.check-paths-tracking.outputs.is-valid == 1 }}
run: exit 1
check-urls-tracking:
if: ${{ always() }}
needs: check-paths-tracking
name: Check URLs Have Tracking
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run Check URLs tracking
id: check-urls-tracking
uses: john0isaac/[email protected]
with:
command: check-urls-tracking
directory: ./
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Leave URLs tracking comment
if: ${{ steps.check-urls-tracking.outputs.is-valid == 1 }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
We have automatically detected missing tracking id from the following URLs in your lessons.
Please check the file paths and associated URLs inside them.
Learn more from our [contributing guide](https://github.com/microsoft/generative-ai-for-beginners/blob/main/CONTRIBUTING.md).
# Check Missing Tracking from URLs
${{ env.URLS_TRACKING }}
`
})
- name: Update workflow run status
if: ${{ steps.check-urls-tracking.outputs.is-valid == 1 }}
run: exit 1
check-urls-locale:
if: ${{ always() }}
needs: check-urls-tracking
name: Check URLs Don't Have Locale
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run Check URLs Country Locale
id: check-urls-locale
uses: john0isaac/[email protected]
with:
command: check-urls-locale
directory: ./
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Leave URLs locale comment
if: ${{ steps.check-urls-locale.outputs.is-valid == 1 }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
We have automatically detected added country locale to URLs in your lessons.
Please check the file paths and associated URLs inside them.
Learn more from our [contributing guide](https://github.com/microsoft/generative-ai-for-beginners/blob/main/CONTRIBUTING.md).
# Check Country Locale in URLs
${{ env.URLS_LOCALE }}
`
})
- name: Update workflow run status
if: ${{ steps.check-urls-locale.outputs.is-valid == 1 }}
run: exit 1