-
Notifications
You must be signed in to change notification settings - Fork 123
62 lines (55 loc) · 1.9 KB
/
generate_api.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
name: Generate API from Spec
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # Every Sunday at midnight GMT
jobs:
generate-api:
if: ${{ github.repository == 'opensearch-project/opensearch-js' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./api_generator
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Config git to rebase
run: git config --global pull.rebase true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Generate API
run: |-
npm run download_spec
npm run generate_api
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: GitHub App token
id: github_app_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.github_app_token.outputs.token }}
commit-message: "Updated opensearch-js to reflect the latest OpenSearch API spec (${{ env.date }})"
title: "[AUTOCUT] Update opensearch-js to reflect the latest OpenSearch API spec (${{ env.date }})"
body: |
Update `opensearch-js` to reflect the latest [OpenSearch API spec](https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml).
Date: ${{ env.date }}
branch: update-api-from-spec-${{ env.date }}
base: main
signoff: true
labels: |
autocut