Files
medusa-store/.github/workflows/generate-references.yml
Shahed Nasser 96629f1916 docs: change process for generating docblocks through actions (#6237)
This PR changes the original process of generating docblocks through actions. The process now is:

1. When a PR is merged for the branch `changeset-release/develop`, the docblock generator tool us used to generate docblocks for the changed files. The changed files are determined by retrieving all comments since the last release and the files in each of those commits.
2. If there are changes after using the docblock generator tool, a PR is opened in the branch `chore/generate-tsdocs`.
3. Once the `chore/generate-tsdocs` is merged, it triggers an action that generates the references for the docs. This changes the previous behaviour of generating references on a new release.

Both actions (that runs the docblock generator tool and that generates references for the docs) can also be triggered manually.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-29 08:05:14 +00:00

105 lines
3.1 KiB
YAML

name: Generate Automated Documentation
on:
workflow_dispatch:
inputs:
referenceName:
description: 'Reference to Generate. Use either `all` to generate all references, `api` to generate the API reference, or `ui` to generate UI reference.'
required: false
default: 'all'
release:
types: [published]
jobs:
api:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || github.event.inputs.referenceName == 'all' || github.event.inputs.referenceName == 'api' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.REFERENCE_PAT }}
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
cache: "yarn"
- name: Install dependencies
uses: ./.github/actions/cache-deps
with:
extension: reference
- name: Build Packages
run: yarn build
- name: Generate API Reference
run: yarn openapi:generate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "chore(docs): Generated API Reference"
base: "develop"
title: "chore(docs): Updated API Reference"
labels: "type: chore"
add-paths: www/apps/api-reference/specs
branch: "docs/generate-api-ref"
branch-suffix: "timestamp"
ui:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || github.event.inputs.referenceName == 'all' || github.event.inputs.referenceName == 'ui' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.REFERENCE_PAT }}
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
cache: "yarn"
- name: Install dependencies
uses: ./.github/actions/cache-deps
with:
extension: reference
- name: Build Packages
run: yarn build
- name: Install Workspace dependencies
run: yarn install
working-directory: docs-util
- name: Build Workspace dependencies
run: yarn build
working-directory: docs-util
- name: Generate UI Specs
run: yarn generate:ui
working-directory: docs-util/packages/react-docs-generator
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "chore(docs): Generated UI Reference"
base: "develop"
title: "chore(docs): Updated UI Reference"
labels: "type: chore"
add-paths: www/apps/ui/src/specs
branch: "docs/generate-ui-ref"
branch-suffix: "timestamp"