-
Notifications
You must be signed in to change notification settings - Fork 11
64 lines (55 loc) · 1.74 KB
/
verify-playlist.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
name: Verify Playlist Submission
on:
pull_request:
paths:
- 'playlist.json'
permissions:
contents: read
issues: write
pull-requests: write
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install jsonschema requests
- name: Run verification script
id: verify
run: python .github/scripts/verify_playlist.py
- name: Read verification result
id: read-result
run: |
if [ -f result.txt ]; then
echo "RESULT<<EOF" >> $GITHUB_ENV
cat result.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "RESULT=Verification script did not produce a result file." >> $GITHUB_ENV
fi
shell: /usr/bin/bash -e {0}
- name: Comment on PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = process.env.RESULT || "❌ Playlist verification failed.";
const issueNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
await github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: issueNumber,
body: output
});
- name: Set workflow status
if: ${{ env.RESULT != '✅ Playlist verification passed! Your submission looks good.' }}
run: exit 1