From 17f2e12e6cabdbdaa5e219ae5c3c800dee3e1fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Steinh=C3=A4user?= <42437185+leonsteinhaeuser@users.noreply.github.com> Date: Sun, 27 Feb 2022 15:15:09 +0100 Subject: [PATCH] fix: GitHub api field value type (#35) * fix: changed single select field option type to String! * test: added random number generator and increased iteration to 3 * docs: added a warning that makes it clear that an update is required. * docs: improved warning format --- README.md | 10 ++++++++++ gh_api_global.sh | 4 ++-- test_user.sh | 10 +++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8141387..239619b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,16 @@ Note: GITHUB_TOKEN does not have the necessary scopes to access projects (beta). You must create a token with ***org:write*** scope and save it as a secret in your repository or organization. For more information, see [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). +> :warning: The GitHub API change of 2022-02-23 results in an error message requiring an upgrade to a new version. +> +> What is the problem? +> +> As of 2022-02-23 , the GitHub API requires that the value of a single select/iteration field be a string instead of an ID! +> +> This causes the automation to throw an error message. +> +> https://github.blog/changelog/2022-02-23-the-new-github-issues-february-23rd-update/ + ## Project board Since the issues and pull requests from this repository are also managed by this automation, you can take an example from the public project board to see what it looks like. diff --git a/gh_api_global.sh b/gh_api_global.sh index d677c15..aed4c69 100644 --- a/gh_api_global.sh +++ b/gh_api_global.sh @@ -22,7 +22,7 @@ function getItemID() { # 1: project id # 2: project item id # 3: field id -# 4: field option id +# 4: field option string (id as string) function updateSingleSelectField() { local project_id=$1 local item_id=$2 @@ -33,7 +33,7 @@ function updateSingleSelectField() { $project: ID! $item: ID! $fieldid: ID! - $fieldOption: ID! + $fieldOption: String! ) { updateProjectNextItemField( input: { diff --git a/test_user.sh b/test_user.sh index cfd646f..9703bd5 100755 --- a/test_user.sh +++ b/test_user.sh @@ -20,21 +20,17 @@ $ENTRYPOINT_SCRIPT "$ENTRYPOINT_MODE" "$ENTRYPOINT_TYPE" "$ORG_OR_USER_NAME" "$P date=$(date -d "+10 days" --rfc-3339=ns | sed 's/ /T/; s/\(\....\).*\([+-]\)/\1\2/g') uuid1=$(uuidgen) uuid2=$(uuidgen) +random_number=$(( $RANDOM % 2500 )) custom_fields="[ { \"name\": \"Priority\", \"type\": \"text\", \"value\": \"$uuid1\" }, - { - \"name\": \"Severity\", - \"type\": \"text\", - \"value\": \"$uuid2\" - }, { \"name\": \"Number\", \"type\": \"number\", - \"value\": \"1000000\", + \"value\": \"$random_number\" }, { \"name\": \"Date\", @@ -49,7 +45,7 @@ custom_fields="[ { \"name\": \"Iteration\", \"type\": \"iteration\", - \"value\": \"Iteration 1\" + \"value\": \"Iteration 3\" } ]"