Skip to content

Commit 17f2e12

Browse files
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
1 parent 83107e5 commit 17f2e12

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ Note: GITHUB_TOKEN does not have the necessary scopes to access projects (beta).
1414
You must create a token with ***org:write*** scope and save it as a secret in your repository or organization.
1515
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).
1616

17+
> :warning: The GitHub API change of 2022-02-23 results in an error message requiring an upgrade to a new version.
18+
>
19+
> What is the problem?
20+
>
21+
> 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!
22+
>
23+
> This causes the automation to throw an error message.
24+
>
25+
> https://github.blog/changelog/2022-02-23-the-new-github-issues-february-23rd-update/
26+
1727
## Project board
1828

1929
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.

gh_api_global.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function getItemID() {
2222
# 1: project id
2323
# 2: project item id
2424
# 3: field id
25-
# 4: field option id
25+
# 4: field option string (id as string)
2626
function updateSingleSelectField() {
2727
local project_id=$1
2828
local item_id=$2
@@ -33,7 +33,7 @@ function updateSingleSelectField() {
3333
$project: ID!
3434
$item: ID!
3535
$fieldid: ID!
36-
$fieldOption: ID!
36+
$fieldOption: String!
3737
) {
3838
updateProjectNextItemField(
3939
input: {

test_user.sh

+3-7
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@ $ENTRYPOINT_SCRIPT "$ENTRYPOINT_MODE" "$ENTRYPOINT_TYPE" "$ORG_OR_USER_NAME" "$P
2020
date=$(date -d "+10 days" --rfc-3339=ns | sed 's/ /T/; s/\(\....\).*\([+-]\)/\1\2/g')
2121
uuid1=$(uuidgen)
2222
uuid2=$(uuidgen)
23+
random_number=$(( $RANDOM % 2500 ))
2324
custom_fields="[
2425
{
2526
\"name\": \"Priority\",
2627
\"type\": \"text\",
2728
\"value\": \"$uuid1\"
2829
},
29-
{
30-
\"name\": \"Severity\",
31-
\"type\": \"text\",
32-
\"value\": \"$uuid2\"
33-
},
3430
{
3531
\"name\": \"Number\",
3632
\"type\": \"number\",
37-
\"value\": \"1000000\",
33+
\"value\": \"$random_number\"
3834
},
3935
{
4036
\"name\": \"Date\",
@@ -49,7 +45,7 @@ custom_fields="[
4945
{
5046
\"name\": \"Iteration\",
5147
\"type\": \"iteration\",
52-
\"value\": \"Iteration 1\"
48+
\"value\": \"Iteration 3\"
5349
}
5450
]"
5551

0 commit comments

Comments
 (0)