-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 1.68 KB
/
update-api-spec.yml
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
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