-
Notifications
You must be signed in to change notification settings - Fork 23
50 lines (41 loc) · 1.27 KB
/
validate-drafts.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
name: Validate draft authors
on:
pull_request:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: "${{ github.event.pull_request.head.sha }}"
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
drafts:
- '_drafts/**'
- name: Get all changed files
if: steps.filter.outputs.drafts == 'true'
id: files
uses: Ana06/[email protected]
- uses: actions/setup-python@v2
if: steps.filter.outputs.drafts == 'true'
with:
python-version: '3.x'
- name: Install python dependencies
if: steps.filter.outputs.drafts == 'true'
run: |
pip install python-frontmatter PyYAML requests
- name: Get validation script from main branch
if: steps.filter.outputs.drafts == 'true'
run: |
rm -rf _scripts
wget https://raw.githubusercontent.com/genicsblog/theme-files/main/_scripts/validate-drafts.py -P _scripts
- name: Validate draft author
if: steps.filter.outputs.drafts == 'true'
run: |
echo "${{ steps.files.outputs.all }}" >> temp.txt
python _scripts/validate-drafts.py ${{ github.event.pull_request.user.login }}
rm temp.txt