lowlighter / gracidea

🌺 A Pokémon 2D live map gathering all regions, including wandering pokémons and characters and animated tiles!
https://gracidea.lecoq.io
GNU Affero General Public License v3.0
217 stars 21 forks source link

feat(preview): add pr link #72

Closed lowlighter closed 2 years ago

lowlighter commented 2 years ago

Something like this:

{
  try {
    const {data:{search:{nodes:[{number:pr}]}}} = await fetch("https://api.github.com/graphql", {
      method:"POST",
      headers:{
        Authorization: `bearer ${Deno.env.get("GITHUB_TOKEN")}`
      },
      body:JSON.stringify({
        query:`query {
          search(query: "repo:lowlighter/gracidea is:pr is:open hash:${Deno.env.get("VERCEL_GIT_COMMIT_SHA")}", type: ISSUE, first: 10) {
            nodes {
              ... on PullRequest {
                number
              }
            }
          }
        }`
      })
    }).then(response => response.json())
  }
  catch (error) {
    log.warn(`failed to get pull request: ${error.message}`)
  }
}