Skip to content

Commit

Permalink
feat: rename project from create-pr.sh to create-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Sep 15, 2024
1 parent e3a82d4 commit 1593559
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# create-pr.sh
# create-pr
PR_TEMPLATE_PATH=".github/PULL_REQUEST_TEMPLATE.md"
PR_TITLE_TEMPLATE="{{TICKET_KEY}}-{{TICKET_NUMBER}} {{PR_TITLE}}"
PR_TICKET_LINK_PREFIX="https://github.com/Chemaclass/create-pr.sh/issues/"
PR_TICKET_LINK_PREFIX="https://github.com/Chemaclass/create-pr/issues/"
PR_LINK_PREFIX_TEXT="Closes: "
PR_LABEL_MAPPING="docs:documentation; fix|bug|bugfix|hotfix:bug; default:enhancement"

Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Please make sure you have [set up your username and email address](https://git-s

## Development

- Entry point `create-pr.sh`
- Entry point `create-pr`
- Isolated testable functions inside files under the `src` directory

### Build
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# create-pr.sh
# create-pr

A bash script that helps create your PRs.
It normalised the PR title, description, assignee by default and initial label based on your branch name.
Expand All @@ -16,7 +16,7 @@ Download the latest `single executable script` on the [Releases page](https://gi

In case you download the executable file from releases' GitHub project, you can check the file's checksum to validate that it was not altered. The checksum for each release is on each release on GitHub.

To build the project yourself, execute the script `./build.sh` and move the resulting `bin/create-pr.sh` script wherever you want.
To build the project yourself, execute the script `./build.sh` and move the resulting `bin/create-pr` script wherever you want.

## How to use it?

Expand Down Expand Up @@ -51,11 +51,11 @@ Text to display if the link does not contain a `TICKET_KEY`.
Branch name: `feat/27-my-branch-name`

```bash
PR_TICKET_LINK_PREFIX="https://github.com/Chemaclass/create-pr.sh/issues/"
PR_TICKET_LINK_PREFIX="https://github.com/Chemaclass/create-pr/issues/"
PR_LINK_PREFIX_TEXT="Closes: "
```

- Result: `Closes: https://github.com/Chemaclass/create-pr.sh/issues/27`
- Result: `Closes: https://github.com/Chemaclass/create-pr/issues/27`

### PR_TITLE_TEMPLATE

Expand Down Expand Up @@ -112,7 +112,7 @@ PR_LABEL_MAPPING="docs:documentation; fix|bug|bugfix|hotfix:bug; default:enhance

## HINTS

- Add to your composer, npm or similar a script pointing to the `create-pr.sh`
- Add to your composer, npm or similar a script pointing to the `create-pr`
- You can use the [PULL_REQUEST_TEMPLATE](./.github/PULL_REQUEST_TEMPLATE.md) from this project as example

## Contribute
Expand Down
12 changes: 4 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function generate_bin() {
temp="$(dirname "$out")/temp.sh"

echo '#!/bin/bash' > "$temp"
echo "Generating create-pr.sh in the '$(dirname "$out")' folder..."
echo "Generating create-pr in the '$(dirname "$out")' folder..."
for file in src/*.sh; do
{
echo "# $file"
Expand All @@ -26,7 +26,7 @@ function generate_bin() {
} >> "$temp"
done

cat create-pr.sh >> "$temp"
cat create-pr >> "$temp"
grep -v '^source' "$temp" > "$out"
rm "$temp"
chmod u+x "$out"
Expand All @@ -53,9 +53,5 @@ function generate_checksum() {
######### MAIN #########
########################

DIR="bin"

mkdir -p "$DIR"
OUT="bin/create-pr.sh"

build "$OUT"
mkdir -p "bin"
build "bin/create-pr"
File renamed without changes.
4 changes: 2 additions & 2 deletions src/console_header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function console_header::print_version() {

function console_header::print_help() {
cat <<EOF
create-pr.sh [arguments] [options]
create-pr [arguments] [options]
Arguments:
None
Expand All @@ -29,6 +29,6 @@ Options:
--help
This message.
See source code: https://github.com/Chemaclass/create-pr.sh
See source code: https://github.com/Chemaclass/create-pr
EOF
}
6 changes: 3 additions & 3 deletions tests/e2e/create-pr_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

function set_up() {
export APP_CREATE_PR_ROOT_DIR=.
export REMOTE_URL="[email protected]:Chemaclass/create-pr.sh.git"
export REMOTE_URL="[email protected]:Chemaclass/create-pr.git"
export BASE_BRANCH="main"
export BRANCH_NAME="feat/ticket-123-my_branch-name"
export PR_TEMPLATE_PATH=".github/PULL_REQUEST_TEMPLATE.md"
export PR_TICKET_LINK_PREFIX="https://github.com/Chemaclass/create-pr.sh/issues/"
export PR_TICKET_LINK_PREFIX="https://github.com/Chemaclass/create-pr/issues/"
export PR_LINK_PREFIX_TEXT="Closes: "
export PR_TITLE_TEMPLATE="{{TICKET_KEY}}-{{TICKET_NUMBER}} {{PR_TITLE}}"
export PR_LABEL_MAPPING="default:enhancement;"

SCRIPT="$CREATE_PR_ROOT_DIR/create-pr.sh"
SCRIPT="$CREATE_PR_ROOT_DIR/create-pr"
}

function test_success() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[DUMP] ./create-pr.sh:55: REMOTE_URL: [email protected]:Chemaclass/create-pr.sh.git
[DUMP] ./create-pr.sh:56: BRANCH_NAME: feat/ticket-123-my_branch-name
[DUMP] ./create-pr.sh:57: PR_USING_CLIENT: github
[DUMP] ./create-pr.sh:58: PR_TEMPLATE: ./.github/PULL_REQUEST_TEMPLATE.md
[DUMP] ./create-pr.sh:59: PR_LABEL: enhancement
[DUMP] ./create-pr.sh:60: PR_TITLE: TICKET-123 My branch name
[DUMP] ./create-pr.sh:61: PR_BODY: ### 🔗 Ticket

Closes: https://github.com/Chemaclass/create-pr.sh/issues/TICKET-123
[DUMP] ./create-pr:55: REMOTE_URL: [email protected]:Chemaclass/create-pr.git
[DUMP] ./create-pr:56: BRANCH_NAME: feat/ticket-123-my_branch-name
[DUMP] ./create-pr:57: PR_USING_CLIENT: github
[DUMP] ./create-pr:58: PR_TEMPLATE: ./.github/PULL_REQUEST_TEMPLATE.md
[DUMP] ./create-pr:59: PR_LABEL: enhancement
[DUMP] ./create-pr:60: PR_TITLE: TICKET-123 My branch name
[DUMP] ./create-pr:61: PR_BODY: ### 🔗 Ticket

Closes: https://github.com/Chemaclass/create-pr/issues/TICKET-123

## 🤔 Background

Expand Down

0 comments on commit 1593559

Please sign in to comment.