Generate API types #58
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: Generate API types | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 4 * * */2" | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
codegen: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
- run: deno task codegen | |
- id: get-metadata | |
run: deno eval 'console.log("version=" + (await import("./TgApi.ts")).TG_API_VERSION)' >> $GITHUB_OUTPUT | |
- uses: actions/create-github-app-token@v1 | |
id: create-token | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.PRIVATE_KEY }} | |
- uses: peter-evans/create-pull-request@v6 | |
id: create-pr | |
with: | |
token: ${{ steps.create-token.outputs.token }} | |
branch: "update-api-types" | |
commit-message: "chore: generate latest Bot API types" | |
title: "feat: update Bot API types to ${{ steps.get-metadata.outputs.version }}" | |
- if: steps.create-pr.outputs.pull-request-operation == 'created' | |
run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}" | |
env: | |
GITHUB_TOKEN: ${{ steps.create-token.outputs.token }} |