Skip to content

Commit

Permalink
Add babel types docs update workflow (#15953)
Browse files Browse the repository at this point in the history
* update setup-node to v3

* add babel-types docs update workflow

* merge update-babel-types-docs into release

* improve PR description

* run babel-docs update workflow on Babel 7 releases only
  • Loading branch information
JLHwung committed Sep 23, 2023
1 parent 4a0af42 commit c3eb254
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ jobs:
# is true. Use the empry string instead.
BABEL_8_BREAKING: ${{ needs.check-release-type.outputs.is-babel-8 == 'true' || '' }}

- name: Generate babel-types docs
continue-on-error: true
run: |
node ./packages/babel-types/scripts/generators/docs.js > ./build/types.md
- name: Upload babel-types docs
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: babel-types.md
path: build/types.md
retention-days: 3

- name: Publish to npm (Babel 7)
run: yarn release-tool publish --yes
if: needs.check-release-type.outputs.is-babel-8 == 'false'
Expand Down Expand Up @@ -263,3 +276,47 @@ jobs:
- name: Delete temporary branch from GitHub
if: needs.git-version.result == 'success'
run: git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" :${{ needs.git-version.outputs.branch }}

types-docs-updates:
name: Update Babel types docs
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
needs:
- check-release-type
- github-release
- github-push
if: |
always() &&
needs.check-release-type.outputs.is-babel-8 == 'false' &&
needs.github-push.result == 'success' &&
needs.github-release.result == 'success' &&
needs.github-release.outputs.is-main
steps:
- uses: actions/checkout@v4
with:
repository: babel/website
- name: Download babel-types docs
uses: actions/download-artifact@v3
with:
name: babel-types.md
path: docs/types.md
- name: Commit Babel website changes
run: |
git config user.name "Babel Bot"
git config user.email "babel-bot@users.noreply.github.com"
git checkout -b update-types-docs
git commit -am "docs: update babel types"
git push --force origin update-types-docs
- name: Create Pull Request
uses: babel/actions/create-pull-request@v2
env:
GITHUB_REPOSITORY: babel/website
with:
token: ${{ secrets.BOT_TOKEN }}
branch: update-types-docs
title: Update Babel types docs
description: Updated `@babel/types` docs for [Babel v${{ needs.github-release.outputs.version }}](https://github.com/babel/babel/releases/tag/${{ needs.github-release.outputs.version }}).
labels: |
docs
repo automation :robot:
2 changes: 1 addition & 1 deletion .github/workflows/update-compat-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
repository: kangax/compat-table
path: packages/babel-compat-data/build/compat-table
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v3
with:
node-version: "*"
- name: Get latest kangax/compat-table commit
Expand Down

0 comments on commit c3eb254

Please sign in to comment.