Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pawel-jedruch-swiftpay opened this issue Apr 22, 2024 · 1 comment

Comments

@pawel-jedruch-swiftpay
Copy link

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?

@gr2m
Copy link
Contributor

gr2m commented Apr 22, 2024

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?

That is correct, actions/create-github-app-token creates installation access token (server-to-server tokens). Personal access tokens cannot be created programmatically without user interaction.

Authentication failed for https://maven.pkg.github.com//repo/...

The // looks odd, maybe an argument is missing, like an org name? I'm not familiar with maven I'm afraid

@actions actions locked and limited conversation to collaborators Apr 22, 2024
@gr2m gr2m converted this issue into discussion #130 Apr 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants