Skip to content

using a GitHub Packages hosted repo in a Java/maven action #25160

Answered by Yanjingzhu
ghost asked this question in Actions
Discussion options

You must be logged in to vote

@cryptearth Sorry for the mistake I’ve been made. Yes , you could use GITHUB_TOKEN in GitHub Actions workflow.  

For the username issue, it doesn’t matter what’s the value it is. You could use github.actor context . 

- name: Build with Maven
   env:
      USENAME: ${{github.actor}}
      PASSWORD: ${{ secrets.GITHUB_TOKEN }}
   run: mvn -B package --file pom.xml --settings settings.xml

Then change the settings.xml <servers> section to :

<servers>
    <server>
      <id>github</id>
      <username>${env.USERNAME}</username>
      <password>${env.PASSWORD}</password>
    </server>
  </servers>

There is not a way to restrict a file to be cloned/forked. And, you are right, this could only w…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Packages Host your dependencies, libraries, and production-ready code, right from your repository Product Feedback
2 participants