Skip to content

Update API and regenerate project #10

Update API and regenerate project

Update API and regenerate project #10

Workflow file for this run

name: Update API and regenerate project
on:
workflow_dispatch: # Manual trigger
repository_dispatch: # when triggered remotely
types:
- api_published # trigger name
# push:
# paths:
# - 'nebius-api'
# - 'nebius-api/**'
jobs:
update-and-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[generators,dev]
pip install tox
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
setup_only: true
- name: Run generation script
run: |
make
- name: Check for Changes
id: check_changes
run: |
git add .
if git diff --cached --quiet; then
echo "changes_detected=false" >> $GITHUB_ENV
else
echo "changes_detected=true" >> $GITHUB_ENV
fi
- name: Bump version
if: env.changes_detected == 'true'
run: |
python src/scripts/version_updater.py ./pyproject.toml patch
git add pyproject.toml
- name: Test
if: env.changes_detected == 'true'
run: |
tox
tox -e test_earliest
- name: Create or update PR
if: env.changes_detected == 'true'
id: cpr
uses: peter-evans/create-pull-request@v7
with:
branch: api-auto-update
title: "Auto-update: API change"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit-message: "Auto-update: API change"
body: |
This PR was automatically created by GitHub Actions. It updates the API and regenerates necessary files.
base: main
delete-branch: true
labels: |
api update
automated pr
- name: Auto approve
if: (steps.cpr.outputs.pull-request-operation == 'created') && (secrets.APPROVER_TOKEN != '')

Check failure on line 84 in .github/workflows/api_update.yml

View workflow run for this annotation

GitHub Actions / Update API and regenerate project

Invalid workflow file

The workflow is not valid. .github/workflows/api_update.yml (Line: 84, Col: 11): Unrecognized named-value: 'secrets'. Located at position 61 within expression: (steps.cpr.outputs.pull-request-operation == 'created') && (secrets.APPROVER_TOKEN != '')
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.APPROVER_TOKEN }}
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash