diff --git a/.github/workflows/label-merge-conflict.yml b/.github/workflows/label-merge-conflict.yml index edbf7defd..14eb0a199 100644 --- a/.github/workflows/label-merge-conflict.yml +++ b/.github/workflows/label-merge-conflict.yml @@ -13,6 +13,6 @@ jobs: - name: Check if PRs have conflicts uses: eps1lon/actions-label-merge-conflict@releases/2.x with: - dirtyLabel: "CONFLICT" + dirtyLabel: "PR: CONFLICT" removeOnDirtyLabel: "Needs review" repoToken: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.scaffold/tests/bats/workflow.utilities.bats b/.scaffold/tests/bats/workflow.utilities.bats index ece7db8e0..0acc4c3ac 100644 --- a/.scaffold/tests/bats/workflow.utilities.bats +++ b/.scaffold/tests/bats/workflow.utilities.bats @@ -72,29 +72,54 @@ load _helper.workflow.bash assert_output_not_contains "ERROR" run curl https://github.com/drevops/scaffold-destination/labels + assert_success - assert_output_contains ">AUTOMERGE<" + assert_output_contains ">BLOCKED<" + assert_output_contains "Issue or pull request is blocked" + assert_output_contains ">PR: AUTOMERGE<" assert_output_contains "Pull request has been approved and set to automerge" - assert_output_contains ">CONFLICT<" + assert_output_contains ">PR: CONFLICT<" assert_output_contains "Pull request has a conflict that needs to be resolved before it can be merged" - assert_output_contains ">DO NOT MERGE<" + assert_output_contains ">PR: Dependencies<" + assert_output_contains "Pull request was raised automatically by a dependency bot" + assert_output_contains ">PR: DO NOT MERGE<" assert_output_contains "Do not merge this pull request" - assert_output_contains ">Do not review<" + assert_output_contains ">PR: Do not review<" assert_output_contains "Do not review this pull request" - assert_output_contains ">Needs review<" + assert_output_contains ">PR: Needs review<" assert_output_contains "Pull request needs a review from assigned developers" - assert_output_contains ">Questions<" - assert_output_contains "Pull request has some questions that need to be answered before further review can progress" - assert_output_contains ">Ready for test<" + assert_output_contains ">PR: Ready for test<" assert_output_contains "Pull request is ready for manual testing" - assert_output_contains ">Ready to be merged<" + assert_output_contains ">PR: Ready to be merged<" assert_output_contains "Pull request is ready to be merged (assigned after testing is complete)" - assert_output_contains ">Requires more work<" + assert_output_contains ">PR: Requires more work<" assert_output_contains "Pull request was reviewed and reviver(s) asked to work further on the pull request" - assert_output_contains ">URGENT<" + assert_output_contains ">PR: URGENT<" assert_output_contains "Pull request needs to be urgently reviewed" - assert_output_contains ">dependencies<" - assert_output_contains "Pull request was raised automatically by a dependency bot" + assert_output_contains ">State: Confirmed<" + assert_output_contains "The issue was triaged and confirmed for development" + assert_output_contains ">State: Done<" + assert_output_contains "The issue is complete and waiting for a release" + assert_output_contains ">State: In progress<" + assert_output_contains "The issue is being worked on" + assert_output_contains ">State: Needs more info<" + assert_output_contains "The issue requires more information" + assert_output_contains ">State: Needs more work<" + assert_output_contains "The issue requires more work" + assert_output_contains ">State: Needs triage<" + assert_output_contains "An issue or PR has not been assessed and requires a triage" + assert_output_contains ">State: QA<" + assert_output_contains "The issue is in QA" + assert_output_contains ">Type: Chore<" + assert_output_contains "Issue is a related to a maintenance" + assert_output_contains ">Type: Defect<" + assert_output_contains "Issue is a defect" + assert_output_contains ">Type: Feature<" + assert_output_contains "Issue is a new feature request" + assert_output_contains ">Type: Question<" + assert_output_contains "Issue is a question" + assert_output_contains ">UPSTREAM<" + assert_output_contains "Issue or pull request is related to an upstream project" assert_output_not_contains ">bug<" assert_output_not_contains ">duplicate<" diff --git a/.scaffold/tests/lint.scripts.sh b/.scaffold/tests/lint.scripts.sh index 5ac97bc9e..40984b391 100755 --- a/.scaffold/tests/lint.scripts.sh +++ b/.scaffold/tests/lint.scripts.sh @@ -33,7 +33,11 @@ for file in "${targets[@]}"; do echo "Checking file ${file}" if ! "${ROOT_DIR}/.scaffold/tests/vendor/bin/shellvar" lint "${file}"; then - exit 1 + # Skip the file with a false positive. + # @see https://github.com/AlexSkrypnyk/shellvar/issues/65 + if [[ ! "${file}" =~ github-labels ]]; then + exit 1 + fi fi if ! LC_ALL=C.UTF-8 shellcheck "${file}"; then diff --git a/renovate.json b/renovate.json index 5844d5251..293cc5e74 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,7 @@ { "extends": ["config:base"], "branchPrefix": "deps/", - "labels": ["dependencies"], + "labels": ["PR: Dependencies"], "assignees": [], "ignorePresets": [":prHourlyLimit2"], "rangeStrategy": "update-lockfile", diff --git a/scripts/drevops/github-labels.sh b/scripts/drevops/github-labels.sh index 59284b052..af269f8ab 100755 --- a/scripts/drevops/github-labels.sh +++ b/scripts/drevops/github-labels.sh @@ -38,17 +38,29 @@ fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 # Array of labels to create. If DELETE_EXISTING_LABELS=1, the labels list will # be exactly as below, otherwise labels below will be added to existing ones. labels=( - "AUTOMERGE" "934BF4" "Pull request has been approved and set to automerge" - "CONFLICT" "bc143e" "Pull request has a conflict that needs to be resolved before it can be merged" - "DO NOT MERGE" "d93f0b" "Do not merge this pull request" - "Do not review" "d93f0b" "Do not review this pull request" - "Needs review" "5319e7" "Pull request needs a review from assigned developers" - "Questions" "b5f492" "Pull request has some questions that need to be answered before further review can progress" - "Ready for test" "0e8a16" "Pull request is ready for manual testing" - "Ready to be merged" "c2e0c6" "Pull request is ready to be merged (assigned after testing is complete)" - "Requires more work" "b60205" "Pull request was reviewed and reviver(s) asked to work further on the pull request" - "URGENT" "d93f0b" "Pull request needs to be urgently reviewed" - "dependencies" "62E795" "Pull request was raised automatically by a dependency bot" + "BLOCKED" "D93F0B" "Issue or pull request is blocked" + "PR: AUTOMERGE" "934BF4" "Pull request has been approved and set to automerge" + "PR: CONFLICT" "bc143e" "Pull request has a conflict that needs to be resolved before it can be merged" + "PR: Dependencies" "62E795" "Pull request was raised automatically by a dependency bot" + "PR: DO NOT MERGE" "d93f0b" "Do not merge this pull request" + "PR: Do not review" "d93f0b" "Do not review this pull request" + "PR: Needs review" "5319e7" "Pull request needs a review from assigned developers" + "PR: Ready for test" "0e8a16" "Pull request is ready for manual testing" + "PR: Ready to be merged" "c2e0c6" "Pull request is ready to be merged (assigned after testing is complete)" + "PR: Requires more work" "b60205" "Pull request was reviewed and reviver(s) asked to work further on the pull request" + "PR: URGENT" "d93f0b" "Pull request needs to be urgently reviewed" + "State: Confirmed" "1183aa" "The issue was triaged and confirmed for development" + "State: Done" "0e8a16" "The issue is complete and waiting for a release" + "State: In progress" "f2f626" "The issue is being worked on" + "State: Needs more info" "adf2cd" "The issue requires more information" + "State: Needs more work" "ecaf2d" "The issue requires more work" + "State: Needs triage" "cccccc" "An issue or PR has not been assessed and requires a triage" + "State: QA" "dbad90" "The issue is in QA" + "Type: Chore" "006b75" "Issue is a related to a maintenance" + "Type: Defect" "d93f0b" "Issue is a defect" + "Type: Feature" "1d76db" "Issue is a new feature request" + "Type: Question" "b5f492" "Issue is a question" + "UPSTREAM" "fbca04" "Issue or pull request is related to an upstream project" # Uncomment default Github labels below to preserve them. # "bug" "d73a4a" "Something isn't working" @@ -265,17 +277,12 @@ jsonval() { local json="${1}" local prop="${2}" - temp=$( - echo "${json}" | - sed 's/\\\\\//\//g' | - sed 's/[{}]//g' | - awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | - sed 's/\"\:\"/\|/g' | - sed 's/[\,]/ /g' | - grep -w "${prop}" | - cut -d":" -f2 | - sed -e 's/^ *//g' -e 's/ *$//g' - ) + temp=$(echo "${json}" | + sed 's/\\\\\//\//g' | + sed 's/[{}]//g' | + awk -v k="text" -F ',"' '{ for (i=1; i<=NF; i++) if ($i ~ /^'"${prop}"'":/) print $i }' | + sed 's/.*:"//g' | + sed 's/"$//g') temp="${temp//${prop}|/}" temp="$(echo "${temp}" | tr '\r\n' ' ')"