Closed NullVoxPopuli closed 1 month ago
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?
We ended up using mshick/add-pr-comment@v2
, but it sure would be nice if the action did this for us.
can you share what you did with mshick/add-pr-comment@v2 ?
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 }}
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 (https://github.com/cloudflare/pages-action/issues/29)
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?
@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.
The integration with github comments on the PR -- example: https://github.com/NullVoxPopuli/ember-resources/pull/513#issuecomment-1141387382
But the pages actions does not