mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 10:51:02 +01:00
bugfix: get issue ID after item creation
This commit is contained in:
38
.github/workflows/add-issue-to-project.yml
vendored
38
.github/workflows/add-issue-to-project.yml
vendored
@@ -9,16 +9,40 @@ jobs:
|
|||||||
name: Add issue to project
|
name: Add issue to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/add-to-project@v0.5.0
|
- name: Add to Project
|
||||||
|
id: add-to-project
|
||||||
|
uses: actions/add-to-project@v0.5.0
|
||||||
with:
|
with:
|
||||||
project-url: https://github.com/orgs/Dictionarry-Hub/projects/1
|
project-url: https://github.com/orgs/Dictionarry-Hub/projects/1
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
|
|
||||||
- name: Set component, type, and status
|
- name: Get project item ID
|
||||||
|
id: get-project-item-id
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
|
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
|
||||||
run: |
|
run: |
|
||||||
|
item_id=$(gh api graphql -f query='
|
||||||
|
query($org: String!, $number: Int!, $nodeId: ID!) {
|
||||||
|
organization(login: $org){
|
||||||
|
projectV2(number: $number) {
|
||||||
|
items(first: 1, filter: {ids: [$nodeId]}) {
|
||||||
|
nodes {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' -f org="Dictionarry-Hub" -F number=1 -f nodeId=$ISSUE_NODE_ID --jq '.data.organization.projectV2.items.nodes[0].id')
|
||||||
|
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Set component, type, and status
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
|
PROJECT_ITEM_ID: ${{ steps.get-project-item-id.outputs.PROJECT_ITEM_ID }}
|
||||||
|
run: |
|
||||||
|
echo "Project Item ID: ${PROJECT_ITEM_ID}"
|
||||||
|
|
||||||
# Set component to "Profilarr"
|
# Set component to "Profilarr"
|
||||||
gh api graphql -f query='
|
gh api graphql -f query='
|
||||||
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
||||||
@@ -34,7 +58,7 @@ jobs:
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${ISSUE_NODE_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCr_E" -f value="48fc49c7"
|
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCr_E" -f value="48fc49c7"
|
||||||
|
|
||||||
# Set status to "Backlog"
|
# Set status to "Backlog"
|
||||||
gh api graphql -f query='
|
gh api graphql -f query='
|
||||||
@@ -51,7 +75,7 @@ jobs:
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${ISSUE_NODE_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCn8s" -f value="f75ad846"
|
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCn8s" -f value="f75ad846"
|
||||||
|
|
||||||
# Get the label of the issue
|
# Get the label of the issue
|
||||||
LABEL=$(gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }} --jq '.labels[0].name')
|
LABEL=$(gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }} --jq '.labels[0].name')
|
||||||
@@ -79,8 +103,8 @@ jobs:
|
|||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
projectV2Item {
|
projectV2Item {
|
||||||
id
|
id
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${ISSUE_NODE_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCswQ" -f value="$ISSUE_TYPE_ID"
|
}
|
||||||
|
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCswQ" -f value="$ISSUE_TYPE_ID"
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user