-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (88 loc) · 3.37 KB
/
update_client.yml
File metadata and controls
100 lines (88 loc) · 3.37 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Update API Client
on:
schedule:
# Run every day at midnight KST (15:00 UTC previous day)
- cron: '0 15 * * *'
workflow_dispatch:
inputs:
runner:
description: 'Choose runner manually (optional)'
type: choice
default: 'auto'
options:
- auto
- self-hosted
- ubuntu-latest
jobs:
setup:
runs-on: ubuntu-latest
outputs:
runner: ${{ steps.set-runner.outputs.runner }}
steps:
- name: Determine runner
id: set-runner
env:
GH_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
run: |
SELECTED_RUNNER="ubuntu-latest"
if [ "${{ github.event.inputs.runner }}" != "" ] && [ "${{ github.event.inputs.runner }}" != "auto" ]; then
SELECTED_RUNNER="${{ github.event.inputs.runner }}"
else
ONLINE_RUNNER=$(gh api repos/${{ github.repository }}/actions/runners --jq '.runners[] | select(.labels[].name=="self-hosted" and .status=="online") | .name' | head -n 1)
if [ ! -z "$ONLINE_RUNNER" ]; then
SELECTED_RUNNER="self-hosted"
fi
fi
echo "runner=$SELECTED_RUNNER" >> $GITHUB_OUTPUT
update-client:
needs: setup
runs-on: ${{ needs.setup.outputs.runner }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fix git safe directory
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
with:
python-version: '3.11'
- name: Set up uv
uses: astral-sh/setup-uv@b5f58b2abc5763ade55e4e9d0fe52cd1ff7979ca
with:
enable-cache: true
- name: Install Dependencies
run: |
uv sync --all-extras --dev
- name: Run Update Script
env:
ASSEMBLY_API_KEY: ${{ secrets.ASSEMBLY_API_KEY }}
run: |
chmod +x scripts/update_client.sh
uv run scripts/update_client.sh
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
- name: Bump Version
if: steps.git-check.outputs.changes == 'true'
id: bump-version
run: |
uv run scripts/bump_version.py
NEW_VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml)
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676
with:
token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
commit-message: "feat: update api client specs to v${{ steps.bump-version.outputs.new_version }}"
title: "Update API Client Specs to v${{ steps.bump-version.outputs.new_version }}"
body: |
This PR updates the API client with the latest specifications from the National Assembly Open API.
- Synced latest master list
- Downloaded new/updated specs
- Regenerated Enums and Pydantic Models
- **Version bumped to ${{ steps.bump-version.outputs.new_version }}**
branch: update-api-specs