Follow Up #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Follow Up | |
on: | |
workflow_dispatch: | |
inputs: | |
run-id: | |
description: docs page GHA run id | |
required: true | |
type: string | |
jobs: | |
follow-up: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
path: unofficial-documentation | |
repository: solvedac/unofficial-documentation | |
github-token: ${{ secrets.PAT_FOLLOW_UP }} | |
run-id: ${{ github.event.inputs.run-id }} | |
- run: tar -xf artifact.tar ./tsp-output/@typespec/openapi3/openapi.yaml | |
working-directory: unofficial-documentation | |
- run: ls -R | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- uses: actions/setup-node@v4 | |
- name: Install Dependencies | |
run: npm install | |
- name: Generate | |
run: npx @openapitools/openapi-generator-cli batch --clean typescript-fetch.yaml | |
- name: Tricky TSC Safety | |
run: | | |
sed -i 's/fetchApi(): FetchAPI/fetchApi(): FetchAPI | undefined/' src/runtime.ts | |
- name: Tricky TSC ESM | |
run: | | |
for file in `find src -type f`; do | |
sed -ri "s/from '([^']+)\/apis'/from '\1\/apis\/index.js'/" $file | |
sed -ri "s/from '([^']+)\/models'/from '\1\/models\/index.js'/" $file | |
sed -ri "s/from '([^']+)'/from '\1.js'/" $file | |
sed -ri "s/from '([^']+\.js)\.js'/from '\1'/" $file | |
done | |
- name: Build | |
run: npm run build | |
- name: Update Version | |
run: | | |
file=unofficial-documentation/tsp-output/@typespec/openapi3/openapi.yaml | |
version=$(sed -rn 's/\s+version:\s*"([^"]+)"/\1/p' $file | sed -rn 's/\.0+([0-9]+)/.\1/p') | |
sed -ri "s/\"version\": \"[^\"]+\"/\"version\": \"$version\"/" package.json | |
- name: Make Deno Friendly | |
run: | | |
for file in `find src -type f -name "index.ts"`; do | |
cp $file `echo $file | sed s/index/mod/` | |
done | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: Follow-up solvedac/unofficial-documentation | |
title: Follow-up solvedac/unofficial-documentation | |
body: | | |
This Pull Request will update the sources based on upstream docs. | |
It is automatically created by GitHub Actions. | |
labels: follow-up |