-
Notifications
You must be signed in to change notification settings - Fork 77
79 lines (64 loc) · 2.13 KB
/
spec.pr.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
name: Spec PR
# This workflow uploads a copy of the spec with the respective changes in the PR
# to the team Space.
#
# The name of the uploaded file will be prefixed with the PR number.
# e.g. `spec-ci/previews/123-spec.yaml
on: [pull_request]
jobs:
lint:
name: Validate spec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run linter
run: make lint
bundle-spec:
name: Bundle Spec
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Bundle
run: make bundle
- uses: actions/upload-artifact@v4
with:
name: openapi-bundled
path: tests/openapi-bundled.yaml
generate-preview:
# As this job needs access to secrets, skip it if the PR comes from a fork.
if: github.event.pull_request.head.repo.full_name == github.repository
name: Generate Preview
runs-on: ubuntu-latest
needs: bundle-spec
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Bundle
run: make bundle
- name: Upload PR spec
run: >-
aws s3 cp tests/openapi-bundled.yaml
${{ env.SPACES_PATH }}/previews/${{ github.event.number }}-spec.yaml
--endpoint=${{ env.SPACES_ENDPOINT }}
--acl public-read
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_ACCESS_SECRET }}
AWS_DEFAULT_OUTPUT: json
SPACES_PATH: ${{ secrets.SPACES_PATH }}
SPACES_ENDPOINT: ${{ secrets.SPACES_ENDPOINT }}
AWS_EC2_METADATA_DISABLED: true
- uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: Spec Preview URL
description: Ready
state: success
sha: ${{ github.event.pull_request.head.sha }}
target_url: https://api-engineering.nyc3.digitaloceanspaces.com/spec-ci/redoc-index.html?pr=${{ github.event.number }}