Skip to content

Commit 88680b0

Browse files
authored
Dump new API automatically in update-api-spec (#348)
Dump the new library API as part of the update-api-spec workflow, including it in the spec update PR. Also improve the update script with some logging and add a link in the PR to the job that created/modified it.
1 parent 9fa42b4 commit 88680b0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/scripts/update_api_spec_version.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
def main(properties_file='gradle.properties'):
1313
current = get_current_api_spec_version(properties_file)
14+
print(f"Current spec version in", properties_file, "is", current, file=sys.stderr)
1415
latest = extract_latest_version()
1516
if current == latest:
1617
exit(1)
@@ -33,7 +34,9 @@ def extract_latest_version():
3334
resp.raise_for_status()
3435
match = re.search(LATEST_VERSION_REGEX, resp.text)
3536
if not match:
36-
raise RuntimeError("Failed to retrieve latest version")
37+
raise RuntimeError(f"Failed to get latest version from {VERSIONS_URL} \
38+
with /{LATEST_VERSION_REGEX}/")
39+
print("First match in HTML of ", VERSIONS_URL, "is", match, file=sys.stderr)
3740
return match.group(1)
3841

3942

.github/workflows/update-api-spec.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
echo "NEW_VERSION=$(cat new.txt)" >> $GITHUB_ENV
3434
fi
3535
rm new.txt || true
36+
- name: gradle :library:apiDump
37+
uses: ./.github/actions/build
38+
with:
39+
dry-run: ${{ inputs.dry_run }}
40+
args: :library:apiDump
3641
- name: Check for existing PR
3742
if: ${{ env.NEW_VERSION }}
3843
run: |
@@ -48,7 +53,12 @@ jobs:
4853
with:
4954
branch: "${{ env.UPDATE_BRANCH }}"
5055
commit-message: "Bump Develocity API spec version to ${{ env.NEW_VERSION }}"
51-
title: "Bump Develocity API spec version to ${{ env.NEW_VERSION }}"
56+
title: |
57+
Bump Develocity API spec version to ${{ env.NEW_VERSION }}
58+
59+
Generated from workflow run [${{ github.run_id }}][1].
60+
61+
[1]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
5262
body: "https://docs.gradle.com/enterprise/api-manual/#release_history"
5363
author: "github-actions <github-actions@github.com>"
5464
committer: "github-actions <github-actions@github.com>"

0 commit comments

Comments
 (0)