Giter VIP home page Giter VIP logo

Comments (7)

IanVS avatar IanVS commented on August 19, 2024 12

Ours (created by @jasikpark) is slightly more complicated, but the same idea. It comments right away at the start of the workflow, then updates it when complete. And each push to the PR updates the comment, rather than leaving a new one.

steps:
      - name: Comment deploy start
        if: github.event_name != 'push'
        uses: mshick/add-pr-comment@v2
        with:
          message-id: cloudflare-deploy
          message: |
            ### <span aria-hidden="true">🚧</span> Deploy Preview building...

            |  Name | Link |
            |---------------------------------|------------------------|
            |<span aria-hidden="true">🔨</span> Latest commit | ${{ github.sha }} |
            |<span aria-hidden="true">🔍</span> Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
            ---
      - ... rest of config
      - name: Comment deploy url
        uses: mshick/add-pr-comment@v2
        with:
          message-id: cloudflare-deploy
          message: |
            ### <span aria-hidden="true">✅</span> Deploy Preview ready!


            |  Name | Link |
            |---------------------------------|------------------------|
            |<span aria-hidden="true">🔨</span> Latest commit | ${{ github.sha }} |
            |<span aria-hidden="true">🔍</span> Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
            |<span aria-hidden="true">😎</span> Deploy Preview Url | [${{ steps.cloudflare.outputs.url }}](${{ steps.cloudflare.outputs.url }}) |
            |<span aria-hidden="true">🌳</span> Environment | ${{ steps.cloudflare.outputs.environment }} |
            ---

We'd love to also include the alias, but it seems that is still broken in the pages-action (#29)

from pages-action.

eerison avatar eerison commented on August 19, 2024 2

just to point out

you need to add permissions.pull-requests: write in your deploy step

e.g:

  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
      pull-requests: write

I guess we could add this info about the comment into the README.md, what do you think?

from pages-action.

sibelius avatar sibelius commented on August 19, 2024 1

we are doing like this

      - name: Publish to Cloudflare Pages
        id: cloudflare-publish
        uses: cloudflare/pages-action@v1
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          projectName: page
          directory: public
          # Optional: Enable this if you want to have GitHub Deployments triggered
          #gitHubToken: ${{ secrets.GITHUB_TOKEN }}
      - uses: mshick/add-pr-comment@v2
        with:
          message: |
            🚀 This branch can be previewed at ${{ steps.cloudflare-publish.outputs.url }}

based on https://github.com/marcus-crane/utf9k/blob/f6a4464e4e4d522fc7cddd7599a7e45a59b86dcd/.github/workflows/deploy.yml#L50

from pages-action.

IanVS avatar IanVS commented on August 19, 2024

Does anyone have a workaround or custom steps they've added to comment the deployment URL back to the PR, until/unless this becomes a built-in feature?

from pages-action.

IanVS avatar IanVS commented on August 19, 2024

We ended up using mshick/add-pr-comment@v2, but it sure would be nice if the action did this for us.

from pages-action.

sibelius avatar sibelius commented on August 19, 2024

can you share what you did with mshick/add-pr-comment@v2 ?

from pages-action.

IanVS avatar IanVS commented on August 19, 2024

@nprogers I see you closed this as completed. Does that mean this action is not being deprecated, and additional features are being added? I'm a bit confused as to the status of this tool.

from pages-action.

Related Issues (20)

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.