aws-amplify / aws-amplify/amplify-hosting

Programatically create PR preview

Open
#3,963 2 comments 5 reactions 1 assignee Claimed by @josefaidt View on GitHub
feature-request
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have removed any sensitive information from my code snippets and submission.

### Amplify Hosting feature

Deployments, Frontend builds, Public APIs, Web previews

### Is your feature request related to a problem? Please describe:

Due to lack of AWS Amplify functionality we can't effectively use PR Preview feature:
- #3959
- #3960
- Hard limit of 50 branches per app [^1]

[^1]: https://docs.aws.amazon.com/amplify/latest/userguide/quotas-chapter.html

As result, we want to create PR previews using AWS CLI, but after testing we found that [`aws amplify create-branch`](https://docs.aws.amazon.com/cli/latest/reference/amplify/create-branch.html) call can't replicate behaviour of automatically created PR previews.

Even though it's possible to set `--stage PULL_REQUEST` resulting branch missing `destinationBranch` and `sourceBranch` properties and as result it's not being treated as PR branch by Amplify Hosting. It seems like those properties are not available in Public APIs.

### Describe how you'd like this feature to work

AWS Amplify allows me to create PR preview branch via CLI, something like:
```
aws amplify create-branch --pr-id 3333 --enable-automatic-build
```

Which in turn will replicate behaviour of automatically generated PR preview, namely:
1. Create PR preview branch
2. Add status check to PR in git provider
3. Publish PR preview URL in PR comments

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.