diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d3d46508f3f..ead891c0a2ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ parameters: distribution-scripts-version: description: "Git ref for version of https://github.com/crystal-lang/distribution-scripts/" type: string - default: "e9cafa1a93a487169e561759e9a2d065c35e0770" + default: "1ee8983d46c594f97b6fe70a711c5dbefe83ab45" previous_crystal_base_url: description: "Prefix for URLs to Crystal bootstrap compiler" type: string diff --git a/scripts/update-distribution-scripts.sh b/scripts/update-distribution-scripts.sh index e8a298fc79f5..d84c3685dd4b 100755 --- a/scripts/update-distribution-scripts.sh +++ b/scripts/update-distribution-scripts.sh @@ -5,7 +5,11 @@ # # Usage: # -# scripts/update-distribution_scripts.sh [REF] +# scripts/update-distribution_scripts.sh [REF] [BRANCH] +# +# Parameters: +# * REF: Git commit SHA in distribution-scripts (default: HEAD) +# * BRANCH: Branch name for CI branch in crystal (default: ci/update-distribution-scripts) # # Requirements: # * packages: git gh sed @@ -20,13 +24,13 @@ GIT_DS="git --git-dir=$DISTRIBUTION_SCRIPTS_WORK_DIR" $GIT_DS fetch origin master -if [ -z "${1:-}"]; then +if [ "${1:-"HEAD"}" = "HEAD" ]; then reference=$($GIT_DS rev-list origin/master | head -1) else reference=${1} fi -branch="ci/update-distribution-scripts" +branch="${2:-"ci/update-distribution-scripts"}" git switch -C "$branch" master @@ -38,8 +42,8 @@ sed -i -E "/distribution-scripts-version:/{n;n;n;s/default: \".*\"/default: \"$r git add .circleci/config.yml message="Updates \`distribution-scripts\` dependency to https://github.com/crystal-lang/distribution-scripts/commit/$reference" -log=$($GIT_DS log $old_reference..$reference --format="%s" | sed "s/.*(/\* crystal-lang\/distribution-scripts/;s/.$//") -message="$message\n\nThis includes the following changes:\n\n$log" +log=$($GIT_DS log $old_reference..$reference --format="%s" | sed "s/.*(/crystal-lang\/distribution-scripts/;s/^/* /;s/.$//") +message=$(printf "$message\n\nThis includes the following changes:\n\n$log") git commit -m "Update distribution-scripts" -m "$message" @@ -47,6 +51,10 @@ git show git push -u upstream "$branch" +# Confirm creating pull request +echo "Create pull request for branch $branch? [y/N]" +read -r REPLY -# Create pull request -gh pr create -R crystal-lang/crystal --fill --label "topic:infrastructure" --assignee "@me" +if [ "$REPLY" = "y" ]; then + gh pr create -R crystal-lang/crystal --fill --label "topic:infrastructure" --assignee "@me" +fi