Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automations start failing #34

Closed
mustafaozhan opened this issue Feb 27, 2022 · 8 comments · Fixed by #35
Closed

Automations start failing #34

mustafaozhan opened this issue Feb 27, 2022 · 8 comments · Fixed by #35
Labels
bug Something isn't working

Comments

@mustafaozhan
Copy link

Describe the bug
Since a couple of days, automations start failing with this error

gh: Type mismatch on variable $fieldOption and argument value (ID! / String!)
{errors:[{path:[mutation,updateProjectNextItemField,input,value],extensions:{code:variableMismatch,variableName:fieldOption,typeName:ID!,argumentName:value,errorMessage:Type mismatch},locations:[{line:13,column:17}],message:Type mismatch on variable $fieldOption and argument value (ID! / String!)}]}

To Reproduce
The step that throws that error:

      - name: 'Move PR to "🏗 PR Review"'
        if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'review_requested'
        uses: leonsteinhaeuser/project-beta-automations@v1.0.1
        with:
          gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          organization: Oztechan
          project_id: 2
          resource_node_id: ${{ github.event.pull_request.node_id }}
          status_value: "🏗 PR Review"

Expected behavior
It should continue to update the status of PR, like before it was doing.

Workflow (please complete the following information):

  • OS: ubuntu-latest
  • App version: @v1.0.1
@mustafaozhan mustafaozhan added the bug Something isn't working label Feb 27, 2022
@leonsteinhaeuser
Copy link
Owner

@mustafaozhan thank you very much for this information. I can see that you are using an "old" version of this automation. I would suggest you to update the version to "v1.2.0" and check if it works or not. If it still does not work, I would ask you to set the following environment variables and provide the output of this action.

    - name: Move issue to ${{ env.todo }}
        uses: leonsteinhaeuser/project-beta-automations@v1.2.0
        env:
          DEBUG_COMMANDS: true
          DEBUG_LOG: true
        with:
          ...

@mustafaozhan
Copy link
Author

Thank you for quick feedback @leonsteinhaeuser!
Here are the logs after increasing the version and setting debug values to true

+ DEBUG_MODE_ENABLED=false
+ ENTRYPOINT_MODE=organization
+ ENTRYPOINT_TYPE=status
+ ORG_OR_USER_NAME=Oztechan
+ PROJECT_ID=2
+ RESOURCE_NODE_ID=PR_kwDOBh4Pds4znrWP
+ RESOURCE_NODE_VALUE='🏗 PR Review'
+ '[' -z organization ']'
+ '[' -z status ']'
+ '[' -z Oztechan ']'
+ '[' -z 2 ']'
+ '[' -z PR_kwDOBh4Pds4znrWP ']'
+ '[' status == custom_field ']'
+ source gh_api_lib_user.sh
++ TMP_STORE_LOCATION=/tmp/api_response.json
+ source gh_api_lib_organization.sh
++ TMP_STORE_LOCATION=/tmp/api_response.json
+ source gh_api_global.sh
+ PROJECT_UUID=
+ PROJECT_ITEM_UUID=
+ log=
+ case "$ENTRYPOINT_MODE" in
+ getOrganizationProject Oztechan 2
+ local ORGANIZATION=Oztechan
+ local PROJECT_NUMBER=2
+ gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f 'query=
    query($organization: String!, $number: Int!) {
        organization(login: $organization){
            projectNext(number: $number) {
                id
                fields(first:20) {
                    nodes {
                        id
                        name
                        settings
                    }
                }
            }
        }
    }' -f organization=Oztechan -F number=2
++ extractOrganizationProjectID
++ sed -e 's+"++g'
++ jq .data.organization.projectNext.id /tmp/api_response.json
+ PROJECT_UUID=PN_kwDOAqMT881gnA
++ getItemID PN_kwDOAqMT881gnA PR_kwDOBh4Pds4znrWP
++ local project_id=PN_kwDOAqMT881gnA
++ local resource_id=PR_kwDOBh4Pds4znrWP
++ gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f 'query=
    mutation($project:ID!, $resource_id:ID!) {
        addProjectNextItem(input: {projectId: $project, contentId: $resource_id}) {
            projectNextItem {
                id
            }
        }
    }' -f project=PN_kwDOAqMT881gnA -f resource_id=PR_kwDOBh4Pds4znrWP --jq .data.addProjectNextItem.projectNextItem.id
++ sed -e 's+"++g'
+ PROJECT_ITEM_UUID=PNI_lADOAqMT881gnM4AJ8tt
+ updateOrganizationScope
+ case "$ENTRYPOINT_TYPE" in
++ extractOrganizationFieldID Status
+++ echo Status
+++ sed -e 's+"++g'
++ local fieldName=Status
++ jq -r '.data.organization.projectNext.fields.nodes[] | select(.name == "Status").id' /tmp/api_response.json
+ STATUS_FIELD_ID=MDE2OlByb2plY3ROZXh0RmllbGQxNzA5OTM=
++ extractOrganizationFieldNodeSelectSettingValue Status '🏗 PR Review'
+++ echo Status
+++ sed -e 's+"++g'
++ local fieldName=Status
+++ echo 🏗 PR Review
+++ sed -e 's+"++g'
++ selectValue='🏗 PR Review'
++ sed -e 's+"++g'
++ jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Status").settings | fromjson.options[] | select(.name=="🏗 PR Review") |.id' /tmp/api_response.json
+ STATUS_FIELD_VALUE_ID=f3c9b[67](https://github.com/Oztechan/CCC/runs/5350228260?check_suite_focus=true#step:4:67)8
++ updateSingleSelectField PN_kwDOAqMT881gnA PNI_lADOAqMT881gnM4AJ8tt MDE2OlByb2plY3ROZXh0RmllbGQxNzA5OTM= f3c9b6[78](https://github.com/Oztechan/CCC/runs/5350228260?check_suite_focus=true#step:4:78)
++ local project_id=PN_kwDOAqMT8[81](https://github.com/Oztechan/CCC/runs/5350228260?check_suite_focus=true#step:4:81)gnA
++ local item_id=PNI_lADOAqMT[88](https://github.com/Oztechan/CCC/runs/5350228260?check_suite_focus=true#step:4:88)1gnM4AJ8tt
++ local field_id=MDE2OlByb2plY3ROZXh0RmllbGQxNzA5OTM=
++ local field_option=f3c9b678
+++ gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f 'query=
    mutation (
        $project: ID!
        $item: ID!
        $fieldid: ID!
        $fieldOption: ID!
    ) {
        updateProjectNextItemField(
            input: {
                projectId: $project
                itemId: $item
                fieldId: $fieldid
                value: $fieldOption
            }
        )
        {
            projectNextItem {
                id
            }
        }
+++ sed -e 's+"++g'
    }' -f project=PN_kwDOAqMT881gnA -f item=PNI_lADOAqMT881gnM4AJ8tt -f fieldid=MDE2OlByb2plY3ROZXh0RmllbGQxNzA5OTM= -f fieldOption=f3c9b678
gh: Type mismatch on variable $fieldOption and argument value (ID! / String!)
++ echo '{errors:[{path:[mutation,updateProjectNextItemField,input,value],extensions:{code:variableMismatch,variableName:fieldOption,typeName:ID!,argumentName:value,errorMessage:Type' 'mismatch},locations:[{line:13,column:17}],message:Type' mismatch on variable '$fieldOption' and argument value '(ID!' / 'String!)}]}'
+ response='{errors:[{path:[mutation,updateProjectNextItemField,input,value],extensions:{code:variableMismatch,variableName:fieldOption,typeName:ID!,argumentName:value,errorMessage:Type mismatch},locations:[{line:13,column:17}],message:Type mismatch on variable $fieldOption and argument value (ID! / String!)}]}'
==========================   Debug mode is ON ==========================
PROJECT_UUID: PN_kwDOAqMT881gnA
PROJECT_ITEM_UUID: PNI_lADOAqMT881gnM4AJ8tt
+ log='\n{errors:[{path:[mutation,updateProjectNextItemField,input,value],extensions:{code:variableMismatch,variableName:fieldOption,typeName:ID!,argumentName:value,errorMessage:Type mismatch},locations:[{line:13,column:17}],message:Type mismatch on variable $fieldOption and argument value (ID! / String!)}]}'
log:

{errors:[{path:[mutation,updateProjectNextItemField,input,value],extensions:{code:variableMismatch,variableName:fieldOption,typeName:ID!,argumentName:value,errorMessage:Type mismatch},locations:[{line:13,column:17}],message:Type mismatch on variable $fieldOption and argument value (ID! / String!)}]}
==========================   Debug mode is ON ==========================
+ '[' true == true ']'
+ echo '==========================   Debug mode is ON =========================='
+ echo 'PROJECT_UUID: PN_kwDOAqMT881gnA'
+ echo 'PROJECT_ITEM_UUID: PNI_lADOAqMT881gnM4AJ8tt'
+ echo -e 'log:\n\n{errors:[{path:[mutation,updateProjectNextItemField,input,value],extensions:{code:variableMismatch,variableName:fieldOption,typeName:ID!,argumentName:value,errorMessage:Type mismatch},locations:[{line:13,column:17}],message:Type mismatch on variable $fieldOption and argument value (ID! / String!)}]}'
+ echo '==========================   Debug mode is ON =========================='

@leonsteinhaeuser
Copy link
Owner

I can reproduce it locally. It seems that GitHub has changed the API that is causing this message. I will take a closer look and try to fix it.

@mustafaozhan
Copy link
Author

@leonsteinhaeuser that's great, will be waiting news from you to update it 😉

@leonsteinhaeuser
Copy link
Owner

@mustafaozhan your described problem should be solved now. I would like to ask you to validate this fix. You should be able to test this with this version: v1.2.1-rc.1. If everything works as expected for you, I will release a new version with this fix.

@mustafaozhan
Copy link
Author

@leonsteinhaeuser I confirm it, it is working as expected 🙂

@leonsteinhaeuser
Copy link
Owner

@mustafaozhan I have released a publicly available version: v1.2.1

@mustafaozhan
Copy link
Author

thanks a lot @leonsteinhaeuser 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants