deploy-to-vercel-action icon indicating copy to clipboard operation
deploy-to-vercel-action copied to clipboard

Fix: replaced the ref sent to Vercel set in `githubCommitRef` by the branch name

Open Elindorath opened this issue 3 years ago • 14 comments

When deploying on a commit event, the ref is in the form refs/heads/${branch} (see github context docs) which is not consistent with the way Vercel works

Elindorath avatar Aug 26 '22 11:08 Elindorath

⚠️ This PR has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week.

BetaHuhnBot avatar Oct 26 '22 01:10 BetaHuhnBot

Just preventing the bot to close this

Elindorath avatar Nov 01 '22 15:11 Elindorath

⚠️ This PR has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week.

BetaHuhnBot avatar Jan 02 '23 01:01 BetaHuhnBot

Once again, just preventing the bot to close this. @BetaHuhn could you please check this out?

Elindorath avatar Jan 05 '23 11:01 Elindorath

⚠️ This PR has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week.

BetaHuhnBot avatar Mar 07 '23 01:03 BetaHuhnBot

Once again, just preventing the bot to close this. @BetaHuhn could you please check this out?

Elindorath avatar Mar 13 '23 13:03 Elindorath

which is not consistent with the way Vercel works

@Elindorath could you elaborate on this?

BetaHuhn avatar Mar 16 '23 09:03 BetaHuhn

@BetaHuhn When github.ref is used (e.g. push trigger), then GH adds the prefix refs/heads/ (e.g. push on foo-bar outputs ref context refs/heads/foo-bar ). This will be visible in the Vercel deployments instead of the 'clear' branch name, e.g. foo-bar (which the default GitHub Action Vercel Bot is using/showing). PR triggers with github.head_ref are not adding the prefix, just the branch name.

One huge issue (despite the cosmetics) comes with the use of preview environments per branch on Vercel. You cannot link a preview environment variable to the deployed branch refs/heads/foo-bar. This is can't be found on Vercel when the project is linked with GitHub; only foo-bar.

I hope this helps 😃

wagnertimo avatar Apr 04 '23 16:04 wagnertimo

Oops, sorry, didn't see your question @BetaHuhn But I see wagnertimo did a good job at explaining the issue 😉 Thanks

Elindorath avatar Sep 04 '23 16:09 Elindorath

I am dealing with the same issue where, I have setup staging environment by pointing a preview branch of name staging to a custom domain. It was working fine with the official vercel app integration but this action prefixes the branch by refs/head which results in vercel not being able to track the staging branch.

@BetaHuhn @wagnertimo please can you guys get this PR merged?

shehroze-1122 avatar Oct 16 '23 11:10 shehroze-1122

Is it possible to merge this pr? We are experiencing the same issue. @BetaHuhn @wagnertimo thanks!

MartinLupa avatar Oct 24 '23 13:10 MartinLupa

Hey @shehroze-1122 and @MartinLupa thx for your interest and request but unfortunately I am not the owner of this repo and have no permission to merge 😞 Please @BetaHuhn look into this... it's a small but powerful change! Thank you

wagnertimo avatar Oct 24 '23 17:10 wagnertimo

Thanks for all your solutions! I have forked this project and published a fixed version that you can use out of box: https://github.com/EvanNotFound/vercel-deployment-for-github-actions

If you need it, feel free to check it out!

CleanShot 2024-02-18 at 00 21 54@2x

EvanNotFound avatar Feb 18 '24 05:02 EvanNotFound

I just updated this PR with the last changes on the repo and made the enhancement suggested by @wagnertimo (thanks btw 😉). @BetaHuhn don't hesitate to tell me if there is something blocking this to be merged.

Elindorath avatar May 13 '24 16:05 Elindorath