-
Notifications
You must be signed in to change notification settings - Fork 453
66 lines (55 loc) · 1.85 KB
/
create_link_to_template.yaml
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
name: Create a link to template on master
on:
pull_request:
types:
- closed
branches:
- master
jobs:
Add_template_link:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Create Output folder
run: |
mkdir -p output/
- name: Get file changes in commit
id: files
uses: jitterbit/get-changed-files@v1
continue-on-error: true
- name: Check .ipynb file existence
run: |
for changed_file in ${{ steps.files.outputs.added_modified }}; do
echo "File: ${changed_file}."
if [[ "${changed_file}" == *".ipynb"* ]]; then
echo ".ipynb file found"
echo "The template is now available on the master branch on this link:
https://github.com/${{ github.event.pull_request.head.repo.full_name }}/blob/master/${changed_file}
" > output/comment.md
else
echo "Not an .ipynb file."
fi
done
- name: Check comment.md existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "output/comment.md"
- name: Upload comment.md as artifact
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/upload-artifact@v1
with:
name: results
path: output
- name: Download comment.md as artifact
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/download-artifact@v1
with:
name: results
- name: comment PR
if: steps.check_files.outputs.files_exists == 'true'
uses: machine-learning-apps/pr-comment@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: results/comment.md