Skip to content

Conversation

Copy link
Contributor

Copilot AI commented May 23, 2025

Our repository uses a non-standard approach to specifying the .NET SDK version in global.json. Instead of using the standard sdk.version property, we use the Arcade-specific tools.dotnet element.

This PR updates the Copilot setup steps to:

  1. Extract the SDK version from tools.dotnet using jq
  2. Pass the extracted version to setup-dotnet using the dotnet-version parameter

Before this change, Copilot was using the global-json-file parameter which doesn't understand our custom structure, potentially using an incorrect SDK version.

      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+      
+      - name: Extract SDK version from global.json
+        id: sdk-version
+        run: |
+          SDK_VERSION=$(jq -r '.tools.dotnet' global.json)
+          echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
+          echo "Extracted .NET SDK version: $SDK_VERSION"

      - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # 4.3.1
        with:
-          global-json-file: global.json
+          dotnet-version: ${{ env.SDK_VERSION }}

Fixes #11890.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@dotnet-policy-service
Copy link
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

Copilot AI changed the title [WIP] Teach Copilot setup about our SDK version Update Copilot setup to use .NET SDK version from tools.dotnet May 23, 2025
Copilot AI requested a review from rainersigwald May 23, 2025 17:05
@rainersigwald rainersigwald marked this pull request as ready for review May 23, 2025 17:09
Copilot AI review requested due to automatic review settings May 23, 2025 17:09
@rainersigwald rainersigwald requested a review from a team as a code owner May 23, 2025 17:09
Copy link
Contributor

Copilot AI left a comment

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 updates the GitHub Actions workflow to pull the .NET SDK version from the custom tools.dotnet property in global.json and supply it directly to actions/setup-dotnet.

  • Added a step to extract the SDK version using jq and set it in the environment
  • Switched setup-dotnet from global-json-file to the extracted dotnet-version parameter
Comments suppressed due to low confidence (2)

.github/workflows/copilot-setup-steps.yml:20

  • [nitpick] Ensure this new step’s indentation matches the existing steps (two extra spaces), so it aligns under steps: with other - uses: entries.
- name: Extract SDK version from global.json

.github/workflows/copilot-setup-steps.yml:23

  • [nitpick] Verify that jq is available on the runner (or add an install step) to avoid failures on environments where jq isn’t preinstalled.
SDK_VERSION=$(jq -r '.tools.dotnet' global.json)

Co-authored-by: Copilot <[email protected]>
@rainersigwald
Copy link
Member

Looks like runtime actually does this a different way; we should probably do the same:

https://github.com/dotnet/runtime/blob/4bdcb8d4b40cae07b3a654d378e0b58bf7d62dd7/.github/workflows/copilot-setup-steps.yml#L40-L44

…nstead of actions/setup-dotnet

Co-authored-by: rainersigwald <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jun 2, 2025

Looks like runtime actually does this a different way; we should probably do the same:

https://github.com/dotnet/runtime/blob/4bdcb8d4b40cae07b3a654d378e0b58bf7d62dd7/.github/workflows/copilot-setu...

Good point! I've updated the approach to follow runtime's pattern. Instead of using actions/setup-dotnet, we now rely on the build system to install .NET to the local .dotnet directory and add it to PATH, just like runtime does. This is simpler and more consistent with how other repositories handle this. See commit 556a436.

@rainersigwald rainersigwald enabled auto-merge (squash) June 5, 2025 14:31
@rainersigwald rainersigwald merged commit 6ab41c0 into main Jun 5, 2025
10 checks passed
@rainersigwald rainersigwald deleted the copilot/fix-11890 branch June 5, 2025 14:39
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.

Teach Copilot setup about our SDK version

4 participants