Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

[RFC] deploy to netlify button on every github repo #6

Open
swyxio opened this issue Jun 9, 2019 · 4 comments
Open

[RFC] deploy to netlify button on every github repo #6

swyxio opened this issue Jun 9, 2019 · 4 comments

Comments

@swyxio
Copy link
Contributor

swyxio commented Jun 9, 2019

browserextension

poc here only works for github right now but this is pretty much all the code needed to do this

var { host, pathname } = document.location
if (host === "github.com" && typeof pathname === "string") {
  const pathsplit = pathname.split("/")
  if (pathsplit.length > 2) {
    const user = pathsplit[1]
    const repo = pathsplit[2]
    const newUrl = `https://app.netlify.com/start/deploy?repository=https://github.com/${user}/${repo}`
    var container = document.createElement("li")
    var newBtn = document.createElement("a")
    newBtn.setAttribute("class", "btn btn-sm")
    newBtn.setAttribute("href", newUrl)
    newBtn.setAttribute("target", "_blank")
    var newContent = document.createTextNode("💎 Deploy To Netlify")
    newBtn.appendChild(newContent)
    container.appendChild(newBtn)

    var el = document.getElementsByClassName("pagehead-actions")[0].children[0]
    el.parentNode.insertBefore(container, el)
  }
}

any comments

@anikethsaha
Copy link

💯

@swyxio
Copy link
Contributor Author

swyxio commented Jun 21, 2019

@oscartbeaumont
Copy link

I am getting this my browser and it is cool but can it only be enabled for repos with a netlify.toml file or be turned off in the extension settings or something. With Github now showing heaps of extra details in that bar, I have seen it take up the entire width of my screen with this extension and also it is sort of annoying seeing it on repos that are not related to websites or Netlify.

@swyxio
Copy link
Contributor Author

swyxio commented Jul 11, 2019

i havent had the time to do this but i think it should just be one more api request. no promises on when i can figure this out but pr welcome

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants