-
Notifications
You must be signed in to change notification settings - Fork 6
59 lines (51 loc) · 1.63 KB
/
release-pr-checks.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
name: Release PR Checks
on:
pull_request:
branches:
- main
jobs:
check-release:
if: startsWith(github.head_ref, 'release')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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 pyyaml semver
- name: Run release checks
run: |
python .github/scripts/check_release.py > errors.txt
- name: Post PR comment on failure
if: failure()
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const errors = fs.readFileSync('errors.txt', 'utf8');
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `### Release PR Checks Failed\n\n${errors}`
})
- name: Post PR comment on success
if: success()
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const errors = fs.readFileSync('errors.txt', 'utf8');
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `### Release PR Checks Passed\n\n${errors}`
})