Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Use branch input when determining GitHub deployment production status #80

Merged
merged 1 commit into from
May 16, 2023
Merged

Use branch input when determining GitHub deployment production status #80

merged 1 commit into from
May 16, 2023

Conversation

iiroj
Copy link
Contributor

@iiroj iiroj commented Apr 23, 2023

This PR fixes issue #79.

@iiroj iiroj requested a review from a team as a code owner April 23, 2023 07:49
@iiroj

This comment was marked as outdated.

@iiroj

This comment was marked as outdated.

@WalshyDev
Copy link
Member

This was done originally however, we have a lot of users specifying branch names that do not exist on GitHub. Deployments require a branch which does exist.
See #70 for more context.

@iiroj
Copy link
Contributor Author

iiroj commented May 14, 2023

Thanks for the reply, @WalshyDev. How about implementing this as an optional input then, for example gitHubDeploymentBranch?

@WalshyDev
Copy link
Member

WalshyDev commented May 14, 2023

If this is just to detect the prod env properly for GitHub deployments I think a better solution is to change the prod check.

- const productionEnvironment = githubBranch === project.production_branch;
+ const productionEnvironment = githubBranch === project.production_branch
+  || branch === project.production_branch;

I don't think another branch input is a good idea here. We have tons of inputs now, we need to make sure they're controlled and not confusing.

@iiroj iiroj changed the title Use branch input for creating GitHub Deployment Use Pages deployment production status for determining GitHub deployment environment May 15, 2023
@iiroj
Copy link
Contributor Author

iiroj commented May 15, 2023

@WalshyDev thanks, your comment made me realise I was thinking this in a bit too complicated way. I dropped one of the commits, and now the GitHub Deployment Preview/Production status is selected based only on the production status of the created Cloudflare Pages deployment.

This still works for my use-case where the production deployment is created from a semver tag (by specifying branch: main input to the action).

What do you think?

@WalshyDev
Copy link
Member

I like this approach. What this is now doing though is making it so Deployments only have 1 stage, deployed/failed. Previously, we had 2 stages. Deploying and deployed/failed.

Since the actual deployment has moved up, we kinda act like there's 2 stages but it'll only go into the deploying state after it's already done.

/~https://github.com/cloudflare/pages-action/pull/80/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R142

/~https://github.com/cloudflare/pages-action/pull/80/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R153-R164

@iiroj
Copy link
Contributor Author

iiroj commented May 16, 2023

True, I can verify it in my own Actions logs. I will investigate if it can be worked around, and otherwise just use "duplicate" logic like you suggested with branch === project.production_branch

src/index.ts Outdated Show resolved Hide resolved
@iiroj iiroj changed the title Use Pages deployment production status for determining GitHub deployment environment Use branch input when determining GitHub deployment production status May 16, 2023
@iiroj iiroj requested a review from WalshyDev May 16, 2023 15:44
Copy link
Member

@WalshyDev WalshyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@WalshyDev WalshyDev merged commit 09ef98d into cloudflare:main May 16, 2023
@iiroj iiroj deleted the branch-deployment-status branch May 16, 2023 16:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants