Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/check-oas-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Check OAS Updates

on:
schedule:
# Run at 00:00 UTC on Monday, Wednesday, and Friday
- cron: "0 0 * * 1,3,5"
workflow_dispatch:
# Allow manual triggering

jobs:
check-oas-updates:
name: Check for OAS updates
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Fetch latest OAS specs
run: bun run fetch:specs

- name: Check for OAS changes
id: check-oas-changes
run: |
if [[ -n "$(git status --porcelain .oas/)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
echo "::notice::OAS changes detected"
else
echo "changes=false" >> $GITHUB_OUTPUT
echo "::notice::No OAS changes detected"
fi

- name: Verify changes work with the codebase
if: steps.check-oas-changes.outputs.changes == 'true'
run: |
# Run tests to ensure the updated OAS files don't break anything
bun run test

# Run linter to ensure code quality
bun run lint

# Verify the package builds correctly with the updated OAS files
bun run build

- name: Configure Git
if: steps.check-oas-changes.outputs.changes == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'

- name: Create Pull Request
if: steps.check-oas-changes.outputs.changes == 'true'
id: create-pr
uses: peter-evans/create-pull-request@v5
with:
commit-message: "chore: update OAS specifications"
title: "chore: update OAS specifications"
body: |
This PR updates the OpenAPI specifications to the latest version.

Changes were automatically detected and committed by the GitHub Actions workflow.

- [x] OAS files updated
- [x] Verified changes work with the codebase (tests, lint, build)
branch: auto-update-oas
base: main
delete-branch: true
labels: |
automated
dependencies

- name: PR Summary
if: steps.create-pr.outputs.pull-request-number
run: |
echo "::notice::Created PR #${{ steps.create-pr.outputs.pull-request-number }} with OAS updates"
echo "::notice::PR URL: ${{ steps.create-pr.outputs.pull-request-url }}"
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
jobs:
test:
runs-on: ubuntu-latest
env:
STACKONE_API_KEY: ${{ secrets.STACKONE_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@v4

Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
40 changes: 40 additions & 0 deletions .oas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated OpenAPI Specifications

This directory contains automatically generated OpenAPI specification files for the StackOne API.

## Important Notes

- **DO NOT EDIT** these files manually. They are automatically generated by the `fetch:specs` script.
- The files in this directory are updated automatically by the GitHub Actions workflow.
- If you need to update these files, run `bun run fetch:specs` or `bun run rebuild`.

## File Structure

Each file represents a different vertical in the StackOne API:

- `ats.json` - Applicant Tracking Systems
- `core.json` - Core API
- `crm.json` - Customer Relationship Management
- `documents.json` - Document Management
- `hris.json` - Human Resources Information Systems
- `iam.json` - Identity and Access Management
- `lms.json` - Learning Management Systems
- `marketing.json` - Marketing Automation

## Adding a new specification

These specs are pulled from the [StackOne Docs](https://docs.stackone.com/openapi).

To add a new specification, run the following command:

```bash
bun run fetch:specs
```

This will download the latest specification and save it in the `.oas` directory.

You may need to update snapshot tests after fetching new specs.

```bash
bun test
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading