-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (36 loc) · 1.4 KB
/
codegen-api-types.yml
File metadata and controls
39 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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@v2
- id: get-old-metadata
run: deno eval 'console.log("version=" + (await import("./TgApi.ts")).TG_API_VERSION)' >> $GITHUB_OUTPUT
- run: deno task codegen
- id: get-new-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 }}
- if: steps.get-old-metadata.outputs.version != steps.get-new-metadata.outputs.version
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-new-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 }}