mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
CI: Label PRs with B2-breaksapi if substrate changes are labelled B2-breaksapi (#862)
* CI: Split common functions into lib.sh and make... ... alert_pending_release.sh check the substrate changes for various labels. If labelled, will be included in the changelog, otherwise will silently be left out. * replace non-standard /bin/bash with /usr/bin/env bash * CI: make lib.sh /bin/sh-compatible * lib.sh: fix newline chars sometimes breaking has_label() * check_runtime.sh: tag change with 'B2-breaksapi'... ... if any substrate changes are also labelled 'B2-breaksapi' * Remove debug exits and uncomment labelling * exit early if we label with breaksapi * fix publish_draft_release.sh
This commit is contained in:
@@ -16,13 +16,16 @@
|
||||
|
||||
set -e # fail on any error
|
||||
|
||||
#Include the common functions library
|
||||
#shellcheck source=lib.sh
|
||||
. "$(dirname "${0}")/lib.sh"
|
||||
|
||||
SUBSTRATE_REPO="https://github.com/paritytech/substrate"
|
||||
SUBSTRATE_REPO_CARGO="git\+${SUBSTRATE_REPO}\?branch=polkadot-master"
|
||||
SUBSTRATE_VERSIONS_FILE="bin/node/runtime/src/lib.rs"
|
||||
|
||||
boldprint () { printf "|\n| \033[1m${@}\033[0m\n|\n" ; }
|
||||
boldcat () { printf "|\n"; while read l; do printf "| \033[1m${l}\033[0m\n"; done; printf "|\n" ; }
|
||||
boldprint () { printf "|\n| \033[1m%s\033[0m\n|\n" "${@}"; }
|
||||
boldcat () { printf "|\n"; while read -r l; do printf "| \033[1m%s\033[0m\n" "${l}"; done; printf "|\n" ; }
|
||||
|
||||
|
||||
# figure out the latest release tag
|
||||
@@ -31,7 +34,7 @@ boldprint "latest release tag ${LATEST_TAG}"
|
||||
|
||||
|
||||
boldprint "latest 10 commits of ${CI_COMMIT_REF_NAME}"
|
||||
git log --graph --oneline --decorate=short -n 10
|
||||
git --no-pager log --graph --oneline --decorate=short -n 10
|
||||
|
||||
boldprint "make sure the master branch is available in shallow clones"
|
||||
git fetch --depth=${GIT_DEPTH:-100} origin master
|
||||
@@ -106,6 +109,22 @@ then
|
||||
spec_version or or impl_version have changed in substrate after updating Cargo.lock
|
||||
please make sure versions are bumped in polkadot accordingly
|
||||
EOT
|
||||
|
||||
# Now check if any of the substrate changes have been tagged B2-breaksapi
|
||||
(
|
||||
cd "${SUBSTRATE_CLONE_DIR}"
|
||||
substrate_changes="$(sanitised_git_logs "${SUBSTRATE_PREV_REF}" "${SUBSTRATE_NEW_REF}")"
|
||||
echo "$substrate_changes" | while read -r line; do
|
||||
pr_id=$(echo "$line" | sed -E 's/.*#([0-9]+)\)$/\1/')
|
||||
|
||||
if has_label 'paritytech/substrate' "$pr_id" 'B2-breaksapi'; then
|
||||
boldprint "Substrate change labelled with B2-breaksapi. Labelling..."
|
||||
github_label "B2-breaksapi"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ has_label(){
|
||||
pr_id="$2"
|
||||
label="$3"
|
||||
out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$repo/pulls/$pr_id")
|
||||
[ -n "$(echo "$out" | jq ".labels | .[] | select(.name==\"$label\")")" ]
|
||||
[ -n "$(echo "$out" | tr -d '\r\n' | jq ".labels | .[] | select(.name==\"$label\")")" ]
|
||||
}
|
||||
|
||||
# Formats a message into a JSON string for posting to Matrix
|
||||
|
||||
@@ -129,6 +129,6 @@ formatted_msg_body=$(cat <<EOF
|
||||
Draft release created: $html_url
|
||||
EOF
|
||||
)
|
||||
send_message "$(structure_message "$msg_body" "$formatted_msg_body")" "$MATRIX_ACCESS_TOKEN"
|
||||
send_message "$(structure_message "$msg_body" "$formatted_msg_body")" "$MATRIX_ROOM_ID" "$MATRIX_ACCESS_TOKEN"
|
||||
|
||||
echo "[+] Done! Maybe the release worked..."
|
||||
|
||||
Reference in New Issue
Block a user