github / github/update-project-action

[Bug] Action fails on pull request close

Open
#12 0 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Dominant language
TypeScript
Stars
34
Forks
19
PR merge metrics
No merged PRs in 30d

Description

### Issue
If a pull request is closed without merging, the action fails with an error at the `Parse content metadata` step.

### Example
```
jq: error (at organization-Breadcord-issue-PR_kwDOItt-hs5Gk46V.json:0): Cannot iterate over null (null)
```

Full debug log from running [this job](https://github.com/Breadcord/Breadcord-Actions-Test/actions/runs/3833859102/jobs/6525848814) in a repository: [debug.log](https://github.com/github/update-project-action/files/10340606/debug.log)

The relevant code from the workflow file:
```yml
on:
issues:
types: [ closed ]
pull_request:
types: [ closed ]

if_closed:
name: Mark as Closed
if: ${{ github.event.issue.state_reason == 'not_planned' || (github.event_name == 'pull_request' && !github.event.pull_request.merged) }}
runs-on: ubuntu-latest
steps:
- uses: Breadcord/update-project-action@main
with:
github_token: ${{ secrets.ACTIONS_TOKEN }}
organization: Breadcord
project_number: 1
content_id: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
field: Status
value: Closed
```

Note that `Breadcord/update-project-action` is a clone of this action, but with PRs #8 and #10 merged in.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.