Skip to content

Extract build into reusable workflow to eliminate redundant clone+install+build across workflows#202

Open
Copilot wants to merge 2 commits intomainfrom
copilot/cache-build-stage
Open

Extract build into reusable workflow to eliminate redundant clone+install+build across workflows#202
Copilot wants to merge 2 commits intomainfrom
copilot/cache-build-stage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

deploy.yml and preview.yml each independently checked out, installed deps, and built — duplicating work on every PR and main push.

Changes

New: .github/workflows/build.yml

Reusable workflow_call workflow encapsulating the full build pipeline. Uploads dist/ as a short-lived artifact consumed by downstream deploy jobs. Accepts an optional base-url input for preview sub-path builds.

deploy.yml / preview.yml

  • Replaced inline build steps with a build job that calls build.yml
  • Added downstream deploy job that needs: build, downloads the artifact, and deploys
  • preview.yml skips the build job on PR close (if: github.event.action != 'closed') while the deploy-preview cleanup job still runs via if: always()

Permissions hardening

Added explicit permissions blocks per job: contents: read for build, contents: write for gh-pages pushes, pull-requests: write for PR preview comments, permissions: {} on workflow_call caller jobs.

Original prompt

cache the build stage of the workflow so it can be reused across workflows instead of cloning and building redundantly


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@ProLoser ProLoser marked this pull request as ready for review March 29, 2026 01:17
@ProLoser ProLoser self-requested a review as a code owner March 29, 2026 01:17
Copilot AI changed the title [WIP] Cache the build stage of the workflow for reusability Extract build into reusable workflow to eliminate redundant clone+install+build across workflows Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants