Shared workflow unable to authenticate with GHP

Hello,

I am having trouble getting my shared workflow to authenticate with GitHub Packages. Nuget specifically. I can get the same steps to work in a regular (non-shared) workflow, but I get 401 unauthorized from GHP in the shared workflow.

My Workflows
The Shared Workflow

name: Main CI

on:
  workflow_call:
    secrets:
      GHP_READ_TOKEN:
        required: true

jobs:

  build:
    name: Unit Tests
    runs-on: self-hosted

    steps:
    
      - name: debug secret
        run: |
           $("${{ secrets.GHP_READ_TOKEN }}" -split "([a-z0-9]{1})"  | ?{ $_.length -ne 0 }) -join " "
        
      - name: 'Checkout'
        uses: actions/checkout@main
        
      - name: Setup .NET Core SDK
        uses: actions/setup-dotnet@v1.7.2
        with:
          dotnet-version: '5.0.x'
          source-url: 'https://nuget.pkg.github.com/FooBar/index.json'
        env:
          NUGET_AUTH_TOKEN: ${{ secrets.GHP_READ_TOKEN }}

      - name: Test
        run: |
          dotnet build

The Calling Workflow

name: CI

on:
  push:
    branches:
    - main
  pull_request:
    types: [opened, synchronize, reopened]

jobs:

  build:
    uses: foobar/shared-workflows/.github/workflows/test-shared-build.yaml@main
    secrets:
      GHP_READ_TOKEN: ${{ secrets.GHP_READ_TOKEN }}

Example Error Output

C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Microsoft\dotnet\sdk\5.0.402\NuGet.targets(131,5): warning : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured. [C:\runners\win_runner_1\run\ach-file-validator-service\ach-file-validator-service\AchFileValidator.sln]

[20](https://github.com/SunriseBanks/ach-file-validator-service/runs/4037110451?check_suite_focus=true#step:5:20) Retrying 'FindPackagesByIdAsync' for source 'https://nuget.pkg.github.com/SunriseBanks/download/mediatr/index.json'.

[21](https://github.com/SunriseBanks/ach-file-validator-service/runs/4037110451?check_suite_focus=true#step:5:21) Response status code does not indicate success: 401 (Unauthorized).

Things I have tried

  1. I validated that the GHP_READ_TOKEN secret is being passed in properly and has the right value
  2. I validated that the PAT being used has the proper scopes and that it works in other contexts

Any ideas on how I can further troubleshoot this issue?

Noooo!

Leaving this here for posterity. Double check you didn’t forget to delete the nuget.config from your repository. :sob: