How to setup Github Actions to use a private repository as a dependency

I am a french Developer, working for a french startup :) i like video games, computers and drinking Ricoré
Search for a command to run...

I am a french Developer, working for a french startup :) i like video games, computers and drinking Ricoré
No comments yet. Be the first to comment.
AWS Bedrock AgentCore lets you deploy agents as managed containerized runtimes. This guide shows how to automate this deployment using Pulumi and Docker. What You'll Deploy Docker container with your agent code Amazon ECR to store the image Bedroc...

Introduction This guide shows how to deploy AWS Bedrock Agents using Pulumi and TypeScript. Prerequisites AWS Account with Bedrock access Node.js and npm installed Pulumi CLI installed Project Setup Generate Project with Pulumi pulumi new aws-t...

Starting My Homelab Journey with a Raspberry Pi 4B

I recently discovered Docker compose profiles and wanted to share it as it can be useful to someone else. Docker Compose profiles let you control which services run without modifying your docker-compose.yml. They’re useful for separating optional s...

These days, i’m using AWS Bedrock to create Agents.And i faced this error when testing my agents many times so i decided to write down the workaround that i found. An error occurred (dependencyFailedException) when calling the InvokeAgent operation: ...

A few weeks ago, I encountered a challenging situation, prompting me to write this article to assist others facing a similar issue.
I maintained a private repository that hosted the code for my application. Additionally, I created a separate private repository for a new library I developed. My objective was to use this library as a dependency in my primary project.
Locally, everything functioned smoothly, primarily due to my SSH key setup. However, when it came to GitHub Actions, I ran into difficulties. The stumbling block was my use of a personal access token (PAT) from a machine user. Specifically, I encountered errors during the npm ci step, primarily stemming from permission issues.
This is how I have managed to install dependencies from private GitHub repositories.
package.json
"dependencies": {
...
"pg": "8.6.0",
"myprivatelib": "orgName/myprivateRepo"
},
# Github Action
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/
- run: npm ci
It is important to disable persisted credentials on actions/checkout, otherwise they will override your PAT.
Your GitHub action should run without any issues now!