-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create new Action to create GitHub deployments from Cloudflare #469
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Meticulous replayed 1 user sessions and took 8 visual snapshots. There were no comparisons made. Test suite: public-tests. Last updated for commit 036865a. This comment will update as new commits are pushed. |
🤖 Meticulous replayed 1 user sessions and took 8 visual snapshots. Meticulous did not run on null of the main branch and so there was nothing to compare against. Please merge your pull request for setting up Meticulous in CI and ensure that it’s running on push events to the main branch. Test suite: test Meticulous with deployment url. Last updated for commit 036865a. This comment will update as new commits are pushed. |
✅ Meticulous spotted zero visual differences across 8 screens tested: view results. Test suite: test Meticulous with app url. Last updated for commit 036865a. This comment will update as new commits are pushed. |
sleep-seconds: | ||
description: 'Time to sleep before starting to poll deployment status (in seconds)' | ||
required: false | ||
default: "300" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the API limits? Is there a risk we'll hit those if we reduce the polling / wait times? 5 minutes initial wait feels long, assuming build times are similar to Vercel, can we wait, say < 30 sec? And also poll every 10 sec or so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 1200 requests per 5 minutes. So assuming the user's token is only being used by us, polling once a minute would mean we can be waiting on 240 concurrent builds without hitting the limit. It might be safe to reduce that, but we might break in cases of tools like dependabot opening a load of PRs at once. Still, halving to 30 seconds is probably safe, I'll do that.
cloudflare-pages/action.yml
Outdated
token: "${{ inputs.github-token }}" | ||
target_url: "${{ steps.get-url.outputs.url }}" | ||
initial_status: "success" | ||
environment: "Meticulous" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does CF Pages return environment name? If so can we use that from there? If not should we give this deployment some non-Meticulous specific name which mentions CF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, let's do Cloudfront Pages: << name there >>
.
cloudflare-pages/action.yml
Outdated
name: 'Meticulous - Trigger tests for Cloudflare Pages' | ||
description: 'Trigger Meticulous tests for a Cloudflare Pages deployment' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming nit: I think a name that relates to how the action works, ie something like 'create a deployment from CF pages preview environment'. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
cloudflare-pages/action.yml
Outdated
echo "Deployment is ready!" | ||
echo "url=`curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/${{ inputs.cloudflare-account-id }}/pages/projects/${{ inputs.cloudflare-project-name }}/deployments" -H "Authorization: Bearer ${{ inputs.cloudflare-api-token }}" -H "Content-Type:application/json" | jq -c 'first(.result[] | select(.deployment_trigger.metadata.commit_hash == "${{ github.sha }}") | .url)' --raw-output | tr -d '\n'`" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does cloudflare-project-name
(or any other part) need to be URL encoded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the project name is alphanumeric plus -
which doesn't need to be encoded. The others are all just alphanumeric.
This is a production-ready version of a script I wrote for a customer. I've expanded it to include waiting if the deployment isn't ready.