Skip to content

Commit

Permalink
fix: GitHub api field value type (#35)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
leonsteinhaeuser committed Feb 27, 2022
1 parent 83107e5 commit 17f2e12
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions gh_api_global.sh
Expand Up @@ -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
Expand All @@ -33,7 +33,7 @@ function updateSingleSelectField() {
$project: ID!
$item: ID!
$fieldid: ID!
$fieldOption: ID!
$fieldOption: String!
) {
updateProjectNextItemField(
input: {
Expand Down
10 changes: 3 additions & 7 deletions test_user.sh
Expand Up @@ -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\",
Expand All @@ -49,7 +45,7 @@ custom_fields="[
{
\"name\": \"Iteration\",
\"type\": \"iteration\",
\"value\": \"Iteration 1\"
\"value\": \"Iteration 3\"
}
]"

Expand Down

0 comments on commit 17f2e12

Please sign in to comment.