Update API spec #549
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: 'Update API spec' | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: 'Dry run' | |
type: boolean | |
default: false | |
workflow_call: | |
inputs: | |
dry_run: | |
description: 'Dry run' | |
type: boolean | |
default: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
update-api-spec: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Update API spec version' | |
run: | | |
if ./.github/scripts/update_api_spec_version.py | tee new.txt; then | |
echo "NEW_VERSION=$(cat new.txt)" >> $GITHUB_ENV | |
fi | |
rm new.txt || true | |
- name: Check for existing PR | |
if: ${{ env.NEW_VERSION }} | |
run: | | |
set -u | |
update_branch="feature/api-spec-$NEW_VERSION" | |
echo "UPDATE_BRANCH=$update_branch" >> $GITHUB_ENV | |
if git ls-remote --exit-code --heads origin "$update_branch"; then | |
echo "EXISTING_PR=true" >> $GITHUB_ENV | |
fi | |
- name: 'Create PR' | |
if: ${{ inputs.dry_run != true && env.NEW_VERSION && !env.EXISTING_PR }} | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
branch: "${{ env.UPDATE_BRANCH }}" | |
commit-message: "Bump Develocity API spec version to ${{ env.NEW_VERSION }}" | |
title: "Bump Develocity API spec version to ${{ env.NEW_VERSION }}" | |
body: "https://docs.gradle.com/enterprise/api-manual/#release_history" | |
author: "github-actions <[email protected]>" | |
committer: "github-actions <[email protected]>" | |
add-paths: "gradle.properties" | |
delete-branch: true |