-
Notifications
You must be signed in to change notification settings - Fork 64
105 lines (99 loc) · 3.24 KB
/
contrib.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
on:
push:
branches:
- main
paths:
- 'contrib/**'
pull_request:
branches:
- main
- develop
types:
- 'review_requested'
paths:
- 'contrib/**'
name: Contrib
jobs:
build-contrib:
runs-on: ubuntu-latest
# permission to the environment will
# need to be approved by one of the collaborators
environment: IMGUR
steps:
- uses: actions/checkout@v4
name: checkout code
with:
fetch-depth: 0
- name: get newly contributed package (pull request)
if: github.event_name == 'pull_request'
run: |
git diff origin/main --name-only | grep -e 'contrib\/[^/]*\/sjtubeamertheme[^/]*\.ltx' | grep -o -e '\/[^/]*\/' | sed -e "s|\/||g" > contrib.txt
- name: get newly contributed packages (push)
if: github.event_name == 'push'
run: |
git diff HEAD^ --name-only | grep -e 'contrib\/[^/]*\/sjtubeamertheme[^/]*\.ltx' | grep -o -e '\/[^/]*\/' | sed -e "s|\/||g" > contrib.txt
- name: read contrib package name
id: contrib_name
uses: juliangruber/[email protected]
with:
path: ./contrib.txt
- uses: xu-cheng/texlive-action@v2
with:
scheme: full
run: |
apk add ghostscript imagemagick gnupg
sed -i "s|<policy domain=\"coder\" rights=\"none\" pattern=\"PDF\" />|<policy domain=\"coder\" rights=\"read\|write\" pattern=\"PDF\" />|g" /etc/ImageMagick-*/policy.xml
.github/ci/build_contrib.sh -halt-on-error -time -xelatex
name: build contrib doc with XeLaTeX
- uses: actions/upload-artifact@v3
with:
path: |
build/contrib.*.pdf
name: upload contrib artifacts
- uses: devicons/[email protected]
id: contrib_png
with:
path: ./build/contrib.*.png
client_id: ${{secrets.IMGUR_CLIENT_ID}}
name: upload contrib img to imgur
- uses: jungwinter/comment@v1
if: github.event_name == 'pull_request'
env:
MESSAGE: |
Thank you for contributing to SJTUBeamer! The name of your contribution is: {0}
Here is the preview of your contribution documentation.
{1}
with:
type: create
issue_number: ${{ github.event.number }}
token: ${{ secrets.GITHUB_TOKEN }}
body: >
${{
format(
env.MESSAGE,
steps.contrib_name.outputs.content,
join(fromJSON(steps.contrib_png.outputs.markdown_urls), ' ')
)
}}
name: comment (review requested)
- uses: jungwinter/comment@v1
if: github.event_name == 'push'
env:
MESSAGE: |
### {0}
@{1}
{2}
with:
type: create
issue_number: '81'
token: ${{ secrets.GITHUB_TOKEN }}
body: >
${{
format(
env.MESSAGE,
steps.contrib_name.outputs.content,
github.actor,
join(fromJSON(steps.contrib_png.outputs.markdown_urls), ' ')
)
}}
name: comment (push)