Skip to content

refactor: skip gh CLI upgrade when already at minimum version for skill support#42639

Merged
pelikhan merged 5 commits into
mainfrom
copilot/refactor-version-constants
Jul 1, 2026
Merged

refactor: skip gh CLI upgrade when already at minimum version for skill support#42639
pelikhan merged 5 commits into
mainfrom
copilot/refactor-version-constants

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The skill installation step unconditionally ran install_gh_cli.sh (full apt-get upgrade) on every workflow run, even when the runner's gh was already new enough. This is wasteful and slow.

Changes

  • pkg/constants/version_constants.go — added GhSkillsMinVersion = "2.90.0", the minimum gh version required for gh extension install (frontmatter skill support).

  • pkg/workflow/compiler_activation_job_builder.go — the generated bash step now checks the current version first and only invokes install_gh_cli.sh when below the minimum. The REQUIRED variable and error message both derive from GhSkillsMinVersion; no hardcoded version strings remain.

Before (always upgrades):

bash "${RUNNER_TEMP}/gh-aw/actions/install_gh_cli.sh"
GH_VERSION=$(gh --version | awk 'NR==1 {print $3}')
REQUIRED="2.90.0"
if ! printf '%s\n%s\n' "$REQUIRED" "$GH_VERSION" | sort -V -C; then
  echo "::error::..." && exit 1
fi

After (upgrades only when needed):

REQUIRED="2.90.0"
GH_VERSION=$(gh --version | awk 'NR==1 {print $3}')
if ! printf '%s\n%s\n' "$REQUIRED" "$GH_VERSION" | sort -V -C; then
  bash "${RUNNER_TEMP}/gh-aw/actions/install_gh_cli.sh"
  GH_VERSION=$(gh --version | awk 'NR==1 {print $3}')
  if ! printf '%s\n%s\n' "$REQUIRED" "$GH_VERSION" | sort -V -C; then
    echo "::error::..." && exit 1
  fi
fi

Copilot AI and others added 2 commits July 1, 2026 04:50
…w 2.90

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…larify comment

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title refactor: only upgrade gh CLI when below minimum version for skill support refactor: skip gh CLI upgrade when already at minimum version for skill support Jul 1, 2026
Copilot AI requested a review from pelikhan July 1, 2026 04:55
@pelikhan pelikhan marked this pull request as ready for review July 1, 2026 05:02
Copilot AI review requested due to automatic review settings July 1, 2026 05:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes activation-job generation for frontmatter skill installation by avoiding an unconditional GitHub CLI (gh) upgrade on every run, and instead only upgrading when the installed gh is below the minimum required for skill support.

Changes:

  • Added a single source of truth (constants.GhSkillsMinVersion) for the minimum gh version required for frontmatter skill support.
  • Updated the activation job’s “Upgrade gh CLI for frontmatter skills” step to version-check first and only run the installer when the runner’s gh is older than the required minimum.
Show a summary per file
File Description
pkg/constants/version_constants.go Adds GhSkillsMinVersion constant for minimum gh skill-support version.
pkg/workflow/compiler_activation_job_builder.go Updates generated bash step to conditionally run the gh upgrade based on current version.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment on lines 546 to 548
ctx.steps = append(ctx.steps, fmt.Sprintf(" REQUIRED=\"%s\"\n", constants.GhSkillsMinVersion))
ctx.steps = append(ctx.steps, " GH_VERSION=$(gh --version | awk 'NR==1 {print $3}')\n")
ctx.steps = append(ctx.steps, " REQUIRED=\"2.90.0\"\n")
ctx.steps = append(ctx.steps, " echo \"gh version: ${GH_VERSION}\"\n")
Comment thread pkg/workflow/compiler_activation_job_builder.go
Copilot AI and others added 3 commits July 1, 2026 05:11
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
….sh and add tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan July 1, 2026 05:23
@pelikhan pelikhan merged commit 50624da into main Jul 1, 2026
27 of 29 checks passed
@pelikhan pelikhan deleted the copilot/refactor-version-constants branch July 1, 2026 05:29
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.

3 participants