API Generator #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
- name: Config git to rebase | ||
run: git config --global pull.rebase true | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
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 "::set-output name=date::$(date +'%Y-%m-%d')" | ||
- name: GitHub App token | ||
id: github_app_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
installation_id: 22958780 | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ steps.github_app_token.outputs.token }} | ||
commit-message: Updated opensearch-js to reflect the latest OpenSearch API spec (${{ steps.date.outputs.date }}) | ||
title: [AUTOCUT] Update opensearch-js to reflect the latest OpenSearch API spec | ||
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: ${{ steps.date.outputs.date }} | ||
branch: update-api-from-spec | ||
base: main | ||
signoff: true | ||
labels: | | ||
autocut |