Skip to content

Generate OpenAPI Types #156

Generate OpenAPI Types

Generate OpenAPI Types #156

name: "Generate OpenAPI Types"
on:
schedule:
- cron: '30 8 * * MON-FRI'
workflow_dispatch:
concurrency:
group: 'scheduled--generate-types'
jobs:
open-api-types:
# since this runs on a schedule, we make sure we only run
# automated tests in the core repository (not forks)
if: ${{github.repository == 'globus/globus-sdk-javascript'}}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/iron
cache: 'npm'
- run: npm ci
- name: Generate Types
run: npm run generate:types
- name: Check for Changes
run: |
if git diff --raw --exit-code; then
echo "changes_exist=false" >> "$GITHUB_ENV"
else
echo "changes_exist=true" >> "$GITHUB_ENV"
fi
- name: Commit Changes
if: ${{ env.changes_exist == 'true' }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b bot-openapi-types
git add .
git commit -m "chore: Updates OpenAPI generated types for Globus Service APIs"
git push --set-upstream origin bot-openapi-types
- name: Open (Draft) Pull Request
if: ${{ env.changes_exist == 'true' }}
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'chore(Compute, Flows, GCS Manager API, Groups, Search, Timer, Transfer): Updates OpenAPI generated types for Globus Service APIs',
owner,
repo,
head: 'bot-openapi-types',
base: 'main',
body: [
'This PR was auto-generated by the `scheduled--generate-types` GitHub Action workflow.',
'### Continuous integration workflows were NOT run on the creation of this pull request.',
'---',
'- [ ] Update the title (scope) of this pull request to match the changes made.',
'- [ ] Close and reopen this pull request to trigger workflows.',
].join('\n'),
draft: true
});