Giter Site home page Giter Site logo

Comments (1)

Hebilicious avatar Hebilicious commented on June 18, 2024

Hello @South-Paw,
I can make a PR with the modifications I made to your action, however I do not have any tests and I'm no longer using a it, so I can't guarantee it won't introduce any bugs 😅

I prefer going with a manual approach for my scripts, which provides more granular control with an acceptable amount of boilerplate in my opinion, here it is if you're interested.
In my opinion this approach is overall better in a lot of scenarios, for example if you plan to use the deployed URL in another step later, or want to customise the message (although all of this could be implemented in the action...)

- name: Deploy website preview to Netlify
  id: deploy
  # Manually run the netlify deploy command, which gives more granular control about version/flags etc
  run: |
      RESULT=$(pnpm deploy:preview)
      echo "::set-output name=result::$(echo $RESULT)"
- name: Comment on PR
  uses: actions/github-script@v6
  id: deploy-preview-url
  with:
      result-encoding: string
      script: |
          const resultString = "'${{ steps.deploy.outputs.result }}'"
          const [logUrl, url] = resultString.match(/https:\/\/\S+/gim)
          const body = 
            `### 🛸 Website Deploy Preview is live 🏌️‍♀️
            |  | URL |
            | --- | --- |
            | 📝 Deploy logs| ${logUrl} |
            | 🌍 Preview | ${url} |
            > Deployed by Netlify`
          const { sha, repo: { owner , repo }, issue: { number }} = context
          const prComment = await github.rest.issues.createComment({ issue_number: number, owner, repo, body })
          console.log({ prComment })
          return url

Let me know if you still want the PR.

from action-netlify-deploy.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.