cli icon indicating copy to clipboard operation
cli copied to clipboard

Support specifying commit sha or commit URL when running "publish"

Open ForbesLindesay opened this issue 5 years ago • 6 comments

Is your feature request related to a problem? Please describe.

When we were using netlify to build we had convenient links from the deploys back to the commit that caused them. Now we are using GitHub actions and the Netlify CLI so we can coordinate the frontend deployment on Netlify with the backend deployment. We would like to be able to see those same links in the deploy log.

Describe the solution you'd like

I would like to be able to specify --commit-url ${GITHUB_COMMIT_URL} and see the familiar commit labeling in the deployments page on the netlify website.

Describe alternatives you've considered

We are using the description, but you can only put a short string there and it does not get turned into a link

Additional context

Can you submit a pull request?

No. I believe this would require changes to how Netlify stores this info/the Netlify API in addition to the change to the CLI

Pull requests are welcome! If you would like to help us add this feature, please check our contributions guidelines.

ForbesLindesay avatar Aug 20 '20 14:08 ForbesLindesay

Hi @ForbesLindesay, thanks for opening this issue.

Could you use https://github.com/ouzi-dev/commit-status-updater to update the commit status?

The CLI triggers a deploy, but doesn't simulate the same mechanisms as the Netlify build system (this would require some thought on the responsibilities of each tool).

erezrokah avatar Aug 20 '20 15:08 erezrokah

That's the inverse problem. I already add a status to the commit, which makes it easy to look at a commit and find the deployed website. I want to be able to look at the deployment history in Netlify and find the commit.

ForbesLindesay avatar Aug 26 '20 11:08 ForbesLindesay

Oh, I get it now. Sorry I missed it initially. Let me look into it further as I believe this will require API support for it. Could also be related to https://github.com/netlify/cli/issues/177

erezrokah avatar Aug 26 '20 15:08 erezrokah

Sorry for the late follow up, opened this related issue for our API https://github.com/netlify/js-client/issues/149

erezrokah avatar Sep 10 '20 09:09 erezrokah

I would like to be able to specify --commit-url ${GITHUB_COMMIT_URL} and see the familiar commit labeling in the deployments page on the netlify website.

One question this raises for me is what information could be added to the website with only a commit URL. The SHA could be added with a link to open it, but a branch name would be absent, no?

If that's true, this ambiguity could cause some confusion. For example, if a commit is present on a feature branch and deployed, then the commit is merged to main and deployed. The deploys would look identical on the website but could have different commit histories. Leaving off a branch name would also make it inconsistent with Netlify CD.

image

blakegearin avatar Mar 08 '22 03:03 blakegearin

So I've given this more thought. Ideally (and assuming API support), the CLI could auto magically do this for users.

  1. Detect it's running in a git repo
  2. Get current branch and commit SHA.
  3. Verify current branch and commit SHA exist on git remote.
  4. Send branch and commit SHA with deploy information to API.

erezrokah avatar Mar 08 '22 10:03 erezrokah