diff --git a/ci-tools/update-nixpkgs b/ci-tools/update-nixpkgs index 3cb23dc45e71d4ad5ca45c595fb3600df500a2c2..748d9862040101fca02a9809cf3a5df4f32b0306 100755 --- a/ci-tools/update-nixpkgs +++ b/ci-tools/update-nixpkgs @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p nixUnstable git openssh curl +#!nix-shell -i bash -p nixUnstable git openssh curl python3 # ^^ # we get nixUnstable for the diff-closures command, mostly. @@ -58,21 +58,22 @@ if git diff --exit-code origin/develop...; then fi # nix-build -A morph -o result-after -# diff=$(nix --extra-experimental-features nix-command store diff-closures ./result-before/ ./result-after/) +# DIFF=$(nix --extra-experimental-features nix-command store diff-closures ./result-before/ ./result-after/) +DIFF="Hello world" git commit -am "bump nixpkgs version" git push --force origin "${TARGET_BRANCH}:${TARGET_BRANCH}" -BODY=$(cat <<EOF -{ - "id": ${CI_PROJECT_ID}, - "source_branch": "${CI_COMMIT_REF_NAME}", - "target_branch": "${TARGET_BRANCH}", - "remove_source_branch": true, - "title": "WIP: ${CI_COMMIT_REF_NAME}", - "assignee_id":"jcalderone" -} -EOF - ) - -curl -X POST --data "${BODY}" --header "Content-Type: application/json" --header "PRIVATE-TOKEN: ${UPDATE_NIXPKGS_PRIVATE_TOKEN}" "https://${HOST}/api/v4/projects/${CI_PROJECT_ID}/merge_requests" +BODY=$(python3 -c ' +import os, sys, json +print(json.dumps({ + "id": os.environ["CI_PROJECT_ID"], + "source_branch": os.environ["CI_COMMIT_REF_NAME"], + "target_branch": os.environ["TARGET_BRANCH"], + "remove_source_branch": True, + "title": f"WIP: {os.environ["CI_COMMIT_REF_NAME"]}", + "description": sys.argv[1], +})) +' "${DIFF}") + +echo curl -X POST --data "${BODY}" --header "Content-Type: application/json" --header "PRIVATE-TOKEN: ${UPDATE_NIXPKGS_PRIVATE_TOKEN}" "https://${HOST}/api/v4/projects/${CI_PROJECT_ID}/merge_requests"