github / update-project-action

Updates an item on a GitHub Projects (beta) board based on a workflow dispatch (or other) event's input.
MIT License
25 stars 16 forks source link

"Item not found with ID" with IDs in issue assigned event payload #55

Open SuaYoo opened 1 year ago

SuaYoo commented 1 year ago

When using the issue assigned trigger, neither setting content_id to github.event.issue.node_id or github.event.issue.id works. Both results in a Item not found with ID error.

Workflow config:

name: Update assigned issues in Webrecorder Projects

on:
  issues:
    types: [assigned]

jobs:
  update-project-column:
    runs-on: ubuntu-latest
    steps:
      - name: Update status
        id: update_status
        uses: github/update-project-action@v2
        with:
          github_token: ${{ secrets.ACTIONS_TOKEN }}
          organization: webrecorder
          project_number: 9
          content_id: ${{ github.event.issue.node_id }}
          field: Status
          value: Todo

Also tried setting content_id: ${{ github.event.issue.id }}

Snuffsis commented 1 year ago

I Just encountered a similar issue. But it only happens for certain issues which were created in a different way from projects.

So, what i did when this started happening was:

  1. In my project i created a draft issue.
  2. In the draft issue i created a task list (the new beta one) with a few tasks
  3. I then converted the main draft issue in the project into an issue.
  4. And then from the task list in this new issue, i created issues from each task.

Now, when my github action is triggered on [closed] to update the "finished date" field

name: "Update Finished Date"
on:
  issues:
    types: [closed]
jobs:
  update_finished_date:
    name: Update Finished Date
    runs-on: ubuntu-latest

with the current date of completion

    steps:
    - name: Get current time
      uses: josStorer/get-current-time@v2
      id: current_time
      with:
        format: YYYY-MM-DD
    - name: Use current time
      env:
        TIME: ${{ steps.current_time.outputs.time }}
        R_TIME: ${{ steps.current_time.outputs.readableTime }}
        F_TIME: ${{ steps.current_time.outputs.formattedTime }}
        YEAR: ${{ steps.current_time.outputs.year }}
        DAY: ${{ steps.current_time.outputs.day }}
      run: echo $TIME $R_TIME $F_TIME $YEAR $DAY

then when I try to add this date value i retrieved


    - name: Checkout code
      uses: actions/checkout@v2

    - name: Update Finished Date Value
      uses: github/update-project-action@v2
      with:
        organization: ${{ github.repository_owner }}
        project_number: 7
        github_token: "${{ secrets.PROJECT_MANAGEMENT }}"
        content_id: ${{ github.event.issue.node_id }}
        field: "Finish Date"
        value: ${{ steps.current_time.outputs.time }}

It works fine for the main issue that contains the task list. But for any issue that is closed that was created through the task list, it fails to work with the node_ids.

examples of output: Here is the action run view image

and then going into the run that succeeded image

compared to one of those that failed image

So, I think there might be some wierd glitch with how certain issues are created possibly? Seeing how the only issue that fail, at least for me, are those that have been created through the new beta task list. At least that is what it seems like when I am comparing it to tracked issues in tasks lists where the issue was added afterwards and created as a draft issue in the project. And when looking at the output in the log, where the format of the node_id's also look different?