|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Update APIs |
| 16 | +on: |
| 17 | + schedule: |
| 18 | + - cron: "0 0 * * *" # Runs every day at midnight |
| 19 | + workflow_dispatch: # Allows manual triggering |
| 20 | +jobs: |
| 21 | + update-apis: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 25 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 26 | + - run: npm ci |
| 27 | + - run: npm run fetch-apis |
| 28 | + - name: Check for changes |
| 29 | + id: changes |
| 30 | + uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0 |
| 31 | + with: |
| 32 | + files: src/apis.ts |
| 33 | + - name: Create Changeset |
| 34 | + if: steps.changes.outputs.any_changed == 'true' |
| 35 | + run: | |
| 36 | + cat <<EOF > .changeset/update-apis.md |
| 37 | + --- |
| 38 | + "google-workspace-developer-tools": patch |
| 39 | + --- |
| 40 | +
|
| 41 | + Update APIs and scopes via the Discovery service |
| 42 | + EOF |
| 43 | + - name: Create Pull Request |
| 44 | + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 |
| 45 | + if: steps.changes.outputs.any_changed == 'true' |
| 46 | + with: |
| 47 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + commit-message: "fix: update APIs via Discovery service" |
| 49 | + title: "fix: update APIs via discovery service" |
| 50 | + body: "This PR updates the APIs based on the latest Discovery documents." |
| 51 | + branch: "update-apis" |
| 52 | + delete-branch: true |
0 commit comments