N
Neon2y ago
genetic-orange

Passing outputs into another job (create-branch-action)

I am using the neondatabase/create-branch-action@v4 github action for ci/cd pipeline. I have configured the ci/cd into 2 jobs where 1 job is responsible for creating a neon branch, I am not able to utilize it to build my app. Reason being they are masked https://github.com/neondatabase/create-branch-action/blob/main/action.yml Note: I am using turborepo(with 3apps to build), that is why I have splited the neon db part to make sure it runs once only. Proposed solution:
- name: Create Neon Branch
id: create-branch
uses: neondatabase/create-branch-action@v4
with:
project_id:
branch_name:
username:
api_key:
mask: false // this
- name: Create Neon Branch
id: create-branch
uses: neondatabase/create-branch-action@v4
with:
project_id:
branch_name:
username:
api_key:
mask: false // this
GitHub
create-branch-action/action.yml at main · neondatabase/create-branc...
GitHub Action to create a new Neon branch. Contribute to neondatabase/create-branch-action development by creating an account on GitHub.
No description
7 Replies
stormy-gold
stormy-gold2y ago
Can you open an issue on the repo?
genetic-orange
genetic-orangeOP2y ago
Sure
harsh-harlequin
harsh-harlequin2y ago
@Hussam, you can call the create branch command again to get the branch details in the next job. Maybe that'll be a suitable workaround?
genetic-orange
genetic-orangeOP2y ago
Yes, that actually works. I get error message(as a log, the step in gh action does not fail) for the other 2 jobs which made me think that was the issue we are facing. But I was wrong, the builds are done with the preview branch urls for all the apps, there's something else going wrong why we are not able to authenticate in the other 2 apps.(but for sure it's not neon that's causing the problem) nonetheless, running it once would be cleaner
harsh-harlequin
harsh-harlequin2y ago
wrong why we are not able to authenticate in the other 2 apps.(but for sure it's not neon that's causing the problem)
I don't follow. Do you mean the DB URLs are set, but you cannot authenticate? Is the username/password missing from the URLs? Agreed. The GitHub example for secret passing is also incomplete, which sucks.
genetic-orange
genetic-orangeOP2y ago
I found out that it's not working because env variables are not set. It does use the neon branch url while doing the build in the workflow, but the DATABASE_URL is not set/accessible for the preview url of the deployment. Here's the link I referred to https://github.com/neondatabase/preview-branches-with-vercel The reason why the first app was working because, I had explicitly set DATABASE_URL for preview in vercel dashboard only for this app. I might be wrong but, but there is a chance that this might be the case with the example as well, where deployement happens using neon branch, but a preview url uses another url. It can easily get unnoticted as both db urls with be having the same seed data. I can't say with confidence that the above is true, I tried digging in vercel cli source code, but couldn'y understand the flow entirely yet.
GitHub
GitHub - neondatabase/preview-branches-with-vercel: Example project...
Example project that shows how you can create a branch for every preview deployment on Vercel using GitHub actions - neondatabase/preview-branches-with-vercel
genetic-orange
genetic-orangeOP2y ago
Update: I tried updating another env and printing it a page, it does pick up the changes. This might have something to do with turborepo, where the env values might not be set in packages.

Did you find this page helpful?