Skip to content

Commit

Permalink
Handle PR case (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
srikrsna-buf authored Jan 25, 2024
1 parent ffa1049 commit 0564151
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/add-to-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ jobs:
echo item_id=$(gh api graphql -f query='query {
repository(name: "${{ github.event.repository.name }}", owner: "${{ github.event.repository.owner.login }}") {
name
issue(number: ${{ github.event.issue.number }}) {
issue(number: ${{ github.event.issue.number }}) @include(if: ${{ github.event.issue.pull_request == null }}) {
projectItems(first: 100) {
nodes {
id
fieldValueByName(name: "Status") {
... on ProjectV2ItemFieldSingleSelectValue {
optionId
}
}
project {
number
}
}
}
}
pullRequest(number: ${{ github.event.issue.number }}) @include(if: ${{ github.event.issue.pull_request != null }}) {
projectItems(first: 100) {
nodes {
id
Expand All @@ -54,7 +69,7 @@ jobs:
}
}
}
}' | jq -r '.data.repository.issue.projectItems.nodes | .[] | select(.project.number==1 and .fieldValueByName.optionId == "dea0b2c9") | .id') >> $GITHUB_OUTPUT
}' | jq -r 'if .data.repository.issue != null then .data.repository.issue else .data.repository.pullRequest end | .projectItems.nodes | .[] | select(.project.number==1 and .fieldValueByName.optionId == "dea0b2c9") | .id') >> $GITHUB_OUTPUT
- name: "Update status"
if: ${{ steps.get_project_item_id.outputs.item_id != '' }}
env:
Expand Down

0 comments on commit 0564151

Please sign in to comment.