-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-grep-3
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Test PR | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: ./backport.functions_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
function get_pr_number() { | ||
|
||
local commit_msg=$1 | ||
echo "$commit_msg" | grep -oP '#(\d+)' | tail -n1 | cut -c2- | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
|
||
# Source the latest version of assert.sh unit testing library and include in current shell | ||
assert_script_content=$(curl --silent https://raw.githubusercontent.com/hazelcast/assert.sh/main/assert.sh) | ||
# shellcheck source=/dev/null | ||
. <(echo "${assert_script_content}") | ||
. "$SCRIPT_DIR"/backport.functions | ||
|
||
TESTS_RESULT=0 | ||
|
||
function test_get_pr_number { | ||
local commit_msg=$1 | ||
local expected_pr_number=$2 | ||
local actual_pr_number=$(get_pr_number "$commit_msg") | ||
local MSG="Expected PR Number extracted from \"$commit_msg\"" | ||
assert_eq "$expected_pr_number" "$actual_pr_number" "$MSG" && log_success "$MSG" || TESTS_RESULT=$? | ||
} | ||
|
||
log_header "Tests for get_pr_number" | ||
test_get_pr_number 'Fix private test repository access [DI-236] (#221)' '221' | ||
test_get_pr_number 'Fix private test repository access [DI-236] (#221) (#222)' '222' | ||
|
||
assert_eq 0 "$TESTS_RESULT" "All tests should pass" |