ci: extract Configure Site URL step into composite action#382
Open
sakinaroufid wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Open
Conversation
Four jobs in docs.yml (build_and_verify_main, build_and_verify_release, deploy_main, deploy_release) duplicated the same nine-line shell block that queries the GitHub Pages API, falls back to a constructed URL, and exports SITE_URL and SPEC_URL to $GITHUB_ENV. Any change to the URL resolution logic required editing four places. Factor the block into a new composite action at .github/actions/configure-site-url, following the existing setup-build-env pattern. The action accepts the GitHub token as an input (defaulting to github.token) and writes the same two environment variables, so downstream steps are unchanged. Net change: 36 LOC of duplication removed, replaced with a single 25-line action plus four one-line 'uses' invocations. No runtime behavior change.
Author
|
Thanks @ptiper - I just pushed it to review |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Four jobs in
.github/workflows/docs.yml(build_and_verify_main,build_and_verify_release,deploy_main,deploy_release) had the same 9-line inline block for resolving the GitHub Pages URL and exportingSITE_URL/SPEC_URLto$GITHUB_ENV. Any change to that logic meant editing all four places in lockstep.Moved it into a composite action at
.github/actions/configure-site-url/action.yml, matching the pattern already used bysetup-build-env. Each call site is now a singleuses:line.Removes 36 lines of duplication. No behavior change, the action exports the same two env vars as before. The
github-tokeninput defaults togithub.token, which is the same token the inline block used viasecrets.GITHUB_TOKEN.I didn't touch the
Configure Git Credentialsblocks (also duplicated, but the context differs slightly across jobs). Happy to do those in a follow-up if wanted.Category (Required)
Please select one or more categories that apply to this change.
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
None.
Checklist
Screenshots / Logs (if applicable)
N/A