-
Notifications
You must be signed in to change notification settings - Fork 34
77 lines (65 loc) · 2.35 KB
/
check-openapi-specs.yml
File metadata and controls
77 lines (65 loc) · 2.35 KB
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
name: Check OpenAPI Specs
on:
pull_request:
paths:
- 'specs/**/tsp-output/@typespec/openapi3/openapi.yaml'
- 'specs/**/_spec_.yaml'
permissions:
contents: read
pull-requests: write # Needed for commenting on PRs
jobs:
check-specs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: |
yarn install --frozen-lockfile
yarn add --dev ts-node -W
- name: Debug working directory
run: |
echo "Current working directory: $(pwd)"
echo "Directory contents:"
ls -la
echo "Specs directory:"
ls -la specs/ || echo "specs directory not found"
- name: Generate report
id: generate-report
env:
RATEMYOPENAPI_KEY: ${{ secrets.RATEMYOPENAPI_KEY }}
GITHUB_EVENT_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo "=== Starting Report Generation ==="
# Run the script and capture stdout for the report
REPORT=$(yarn ts-node tools/scripts/generate-matrix.ts)
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo "Failed to generate report"
exit 1
fi
# Capture for GitHub output
echo "report<<EOF" >> $GITHUB_OUTPUT
echo "$REPORT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "=== Report Generation Complete ==="
- name: Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: "OpenAPI Specification Analysis"
- name: Create or Update Comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.find-comment.outputs.comment-id || '' }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.generate-report.outputs.report }}
edit-mode: replace