Skip to content

Commit

Permalink
Merge pull request #58 from Chemaclass/feat/52-add-reviewers-config
Browse files Browse the repository at this point in the history
Allow adding reviewers via local .env
  • Loading branch information
Chemaclass authored Oct 28, 2024
2 parents 9b46915 + 161b0bc commit 3b54314
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Add `PR_TITLE_REMOVE_PREFIX`
- Use ticket number only at the beginning of branch name
- Allow adding reviewers via local .env

## [0.7](https://github.com/Chemaclass/create-pr/compare/0.6...0.7) - 2024-09-29

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ It normalizes the PR title, description, assignee by default, and initial label

## Current support

- **GitHub** requires https://cli.github.com/
- **GitLab** requires https://docs.gitlab.com/ee/editor_extensions/gitlab_cli/
- **GitHub** requires https://cli.github.com/manual/gh_pr_create
- **GitLab** requires https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/mr/create.md

> These are needed to access your client via the terminal, and they are independent of this script.
Expand Down Expand Up @@ -122,6 +122,12 @@ PR_LABEL_MAPPING="docs:documentation; fix|bug|bugfix|hotfix:bug; default:enhance
- `PR_ASSIGNEE` or `@me` by default

### PR_REVIEWER

> Alias: REVIEWER
- Empty by default

### TARGET_BRANCH

- `TARGET_BRANCH` or `main` by default
Expand Down
2 changes: 2 additions & 0 deletions src/env_configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PR_TEMPLATE="$APP_CREATE_PR_ROOT_DIR/$PR_TEMPLATE_PATH"
PR_TITLE_TEMPLATE=${PR_TITLE_TEMPLATE:-"{{TICKET_KEY}}-{{TICKET_NUMBER}} {{PR_TITLE}}"}
PR_TITLE_REMOVE_PREFIX=${PR_TITLE_REMOVE_PREFIX:-"be,fe"}
PR_ASSIGNEE=${PR_ASSIGNEE:-${ASSIGNEE:-"@me"}}
PR_REVIEWER=${PR_REVIEWER:-${REVIEWER:-""}}
TARGET_BRANCH=${TARGET_BRANCH:-"main"}
CURRENT_BRANCH=${CURRENT_BRANCH:-"$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"} \
|| error_and_exit "Failed to get the current branch name."
Expand All @@ -34,5 +35,6 @@ export PR_TITLE_TEMPLATE
export PR_TITLE_REMOVE_PREFIX
export PR_TEMPLATE
export PR_ASSIGNEE
export PR_REVIEWER
export TARGET_BRANCH
export CURRENT_BRANCH
2 changes: 2 additions & 0 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function main::create_pr_gitlab() {
--target-branch "$TARGET_BRANCH"
--source-branch "$CURRENT_BRANCH"
--assignee "$PR_ASSIGNEE"
--reviewer "$PR_REVIEWER"
--label "$PR_LABEL"
--description "$PR_BODY"
)
Expand All @@ -51,6 +52,7 @@ function main::create_pr_github() {
--base "$TARGET_BRANCH"
--head "$CURRENT_BRANCH"
--assignee "$PR_ASSIGNEE"
--reviewer "$PR_REVIEWER"
--label "$PR_LABEL"
--body "$PR_BODY"
)
Expand Down

0 comments on commit 3b54314

Please sign in to comment.