Search code examples
.net-corenugetgithub-actions

Github action build step fails because platform doesnt support encryption, platform shouldnt need to support it?


The add github source step of my gh action is failing:

name: buildTest

on:
  push:
    branches: [ main ]
    paths:
    - '**.cs'
    - '**.csproj'
    - '**build-test.yml'
  pull_request:
    branches: [ main ]
    paths:
    - '**.cs'
    - '**.csproj'
    - '**build-test.yml'

env:
  DOTNET_VERSION: '6.0.401' # The .NET SDK version to use

jobs:
  build:

    name: build-${{matrix.os}}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}

    - name: Add Github nuget source
      run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.BH_GH_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/PT/index.json"

    - name: Install dependencies
      run: dotnet restore

    - name: Build
      run: dotnet build --configuration Release --no-restore

The error is as shown:

    Run dotnet nuget add source "https://nuget.pkg.github.com/PT/index.json" --name github --username user-william -***
error: Password encryption is not supported on .NET Core for this platform. The following feed try to use an encrypted password: 'github'. You can use a clear text password as a workaround.
error:   Encryption is not supported on non-Windows platforms.

All of the solutions I can find suggest adding '--store-password-in-clear-text' to the command, which as you can see is already there. The action is being run on ubuntu-latest. Has anyone else run into this issue? I copied the step from another repo and it works there.


Solution

  • I created the action secret with the wrong name. The action was looking for BH_GH_TOKEN but only BH_GITHUB_TOKEN was available lol.

    If the password is null then '--store-password-in-clear-text' is filtered out of the command and the real issue of the missing password is hidden by the platforms inability to encrypt the non-existing password.

    So if you see this happen, check your repo secret name lol.