cloudflare / pages-action

MIT License
468 stars 95 forks source link

Branch option not controlling GitHub Deployment status #79

Closed iiroj closed 1 year ago

iiroj commented 1 year ago

This action allows using branch option, as per readme:

The branch name is used by Cloudflare Pages to determine if the deployment is production or preview

Looks like it correctly passes it to wrangler in the action:

https://github.com/cloudflare/pages-action/blob/586d3c53b9daa978dfb149a41a624f9311ebf5c9/src/index.ts#L37

However, this option is not used for determining whether the optional GitHub Deployment is production or not:

https://github.com/cloudflare/pages-action/blob/586d3c53b9daa978dfb149a41a624f9311ebf5c9/src/index.ts#L130

Where githubBranch is always:

https://github.com/cloudflare/pages-action/blob/586d3c53b9daa978dfb149a41a624f9311ebf5c9/src/index.ts#L51

I would expect if the branch option is passed, it would also be used to determine if the GitHub Deployment is for production or development, for example:

--- const githubBranch = env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME;
+++ const githubBranch = branch || env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME;

Currently I'm deploying to production from a git tag (semantic version), and even though I can create a production deployment to Cloudflare Pages by specifying branch: main manually, I have to disable the GitHub Deployment created by this action, and set it manually instead. You can see my project and actions here: https://github.com/iiroj/iiro.fi

WalshyDev commented 1 year ago

Closed in #80