Skip to content

Commit 61b2a91

Browse files
committed
Create deploy-pr.sh
1 parent 3bd1631 commit 61b2a91

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/deploy-pr.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Usage: ./deploy-pr.sh
3+
# deploys the current branch to a PR environment and posts login credentials to [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel
4+
branchName=$(gh pr view --json headRefName | jq -r .headRefName)
5+
if [[ "$branchName" == "main" ]]; then
6+
# get commit sha --short
7+
commitSha=$(git rev-parse --short HEAD)
8+
gh workflow run pr-deploy.yaml /
9+
--ref $branchName /
10+
-f pr_number=${commitSha}
11+
else
12+
prNumber=$(gh pr view --json number | jq -r .number)
13+
gh workflow run pr-deploy.yaml /
14+
--ref $branchName /
15+
-f pr_number=${prNumber}

0 commit comments

Comments
 (0)