docs-util: fix release scripts (#6353)

- Fix GitHub action to run on push and check if the commit message is "chore: Release". Only then are TSDocs generated and a PR is opened.
- Add an option to pass to the `run:release` method of the docblock generator a release tag. This is helpful in cases when the GitHub action fails for any reason.
- Add scripts that checks the message of a commit.
This commit is contained in:
Shahed Nasser
2024-02-08 22:36:27 +02:00
committed by GitHub
parent ef64f3740d
commit 66e8f4e0d2
7 changed files with 88 additions and 9 deletions

View File

@@ -1,16 +1,13 @@
name: Generate Docblocks [Automated]
on:
pull_request:
push:
branches:
- develop
types:
- closed
workflow_dispatch:
jobs:
generate:
if: github.event_name == 'workflow_dispatch' || (startsWith(github.head_ref, 'changeset-release/develop') && github.event.pull_request.merged == true)
name: Generated TSDoc PRs
runs-on: ubuntu-latest
steps:
@@ -32,8 +29,18 @@ jobs:
- name: Build packages
run: yarn build
working-directory: docs-util
- name: Check Commit
id: check-commit
run: 'yarn check:release-commit ${{ github.sha }}'
working-directory: docs-util/packages/scripts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_OWNER: ${{ github.repository_owner }}
GIT_REPO: medusa
- name: Run docblock generator
if: steps.check-commit.outputs.is_release_commit == true
run: "yarn start run:release"
working-directory: docs-util/packages/docblock-generator
env:
@@ -42,6 +49,7 @@ jobs:
GIT_REPO: medusa
- name: Create Pull Request
if: steps.check-commit.outputs.is_release_commit == true
uses: peter-evans/create-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}