Skip to content

Generate a personal access token (classic) to access maven reposiotry #129

@pawel-jedruch-swiftpay

Description

@pawel-jedruch-swiftpay

We do have two private repositories in our organization, let's call them: library and project. The library is hosted in the Maven GitHub repository. The project workflow is using a personal access token for authorization (according to documentation.

Now we want to migrate to actions/create-github-app-token, but I was unable to create a working solution.

.github/workflows/example.yml
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Get token from Github App
      uses: actions/create-github-app-token@v1
      id: app-token
      with:
        app-id: ${{ secrets.GET_TOKEN_APP_ID }}
        private-key: ${{ secrets.GET_TOKEN_APP_PRIVATE_KEY }}
        owner: ${{ github.repository_owner }}
 
    - name: Set up Maven
      uses: actions/setup-java@v4
      with:
        java-version: '17'
        distribution: 'corretto'
        cache: 'maven'
        server-username: MAVEN_USERNAME
        server-password: MAVEN_PASSWORD

    - name: Build and Package
      run: |
        cd project
        mvn clean package
      env:
        MAVEN_USERNAME: ${{ github.actor }}
        MAVEN_PASSWORD: ${{ steps.app-token.outputs.token }}

I've tried multiple configurations but always end up with the following error:

Authentication failed for https://maven.pkg.github.com//repo/..., status: 401 Unauthorized -> [Help 1]

What I'm guessing is that create-github-app-token doesn't support a personal access token. Could you confirm if this is the case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions