-
Notifications
You must be signed in to change notification settings - Fork 2.3k
54 lines (47 loc) · 1.83 KB
/
check_icon_pr.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
name: Check Icon PR
on: pull_request
jobs:
check:
name: Check the `devicon.json` and the SVGs' quality
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.title, 'new icon') || startsWith(github.event.pull_request.title, 'update icon') # only checks icon PR
steps:
- uses: actions/checkout@v4
- name: Check if PR is develop
if: ${{ github.base_ref != 'develop' }}
run: |
echo -e "The PR's base branch is \`${{ github.base_ref }}\`, but should be \`develop\`\nPlease change the PR so that it's based on, and merged into \`develop\`" > ./err_messages.txt
echo "wrong_branch=true" >> $GITHUB_ENV
- uses: actions/setup-python@v4
if: ${{ !env.wrong_branch }}
with:
python-version: 3.8
- name: Install dependencies
if: ${{ !env.wrong_branch }}
run: |
python -m pip install --upgrade pip
pip install -r ./.github/scripts/requirements.txt
- name: Run the check_svg script
if: ${{ !env.wrong_branch }}
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_ICONS=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }} | grep -E 'icons/.*\.svg')
python ./.github/scripts/check_icon_pr.py ./icons ./devicon.json ${CHANGED_ICONS}
- name: Upload the err messages
uses: actions/upload-artifact@v3
if: success()
with:
name: err_messages
path: ./err_messages.txt
- name: Save the pr num in an artifact
shell: bash
if: success()
env:
PR_NUM: ${{ github.event.number }}
run: echo $PR_NUM > pr_num.txt
- name: Upload the pr num
uses: actions/upload-artifact@v3
if: success()
with:
name: pr_num
path: ./pr_num.txt