Skip to content

Commit

Permalink
ci: fix update-project workflow
Browse files Browse the repository at this point in the history
Successfull example:
FFY00/test-label-mapping#4

Signed-off-by: Filipe Laíns <[email protected]>
  • Loading branch information
FFY00 committed May 26, 2024
1 parent a6105dd commit 1fd9826
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 15 deletions.
49 changes: 39 additions & 10 deletions .github/workflows/update-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,45 @@ jobs:
repository-projects: write
steps:
- uses: actions/checkout@v4
- name: Get column name
id: get-column-name
- name: Get column ID
id: get-column
run: |
value=$(jq -r .labelToColumn.\"${{ github.event.label.name }}\" update-project.json)
echo "name=$value" >>$GITHUB_OUTPUT
echo "Column Name: $value"
value=$(jq -r .labelToColumnId.\"${{ github.event.label.name }}\" update-project.json)
echo "id=$value" >>$GITHUB_OUTPUT
echo "Label: ${{ github.event.label.name }}"
echo "Column id: $value"
- name: Add issue to project
if: ${{ steps.get-column.outputs.id != 'null' }}
id: add-to-project
uses: actions/[email protected]
with:
project-url: https://github.com/orgs/pyOpenSci/projects/7
github-token: ${{ secrets.GHPROJECT_TOKEN }}
- name: Move issue to column
if: ${{ steps.get-column-name.outputs.name != 'null' }}
uses: alex-page/[email protected]
if: ${{ steps.get-column.outputs.id != 'null' }}
uses: octokit/[email protected]
with:
project: peer-review-status
column: ${{ steps.get-column-name.outputs.name }}
repo-token: ${{ secrets.GHPROJECT_TOKEN }}
query: |
mutation($project: ID!, $item: ID!, $field: ID!, $column: String!) {
updateProjectV2ItemFieldValue(
input: {
projectId: $project
itemId: $item
fieldId: $field
value: {
singleSelectOptionId: $column
}
}
) {
projectV2Item {
id
}
}
}
variables: |
project: "PVT_kwDOAbmP7s4ASqjL"
item: ${{ steps.add-to-project.outputs.itemId }}
field: "PVTSSF_lADOAbmP7s4ASqjLzgL66FI"
column: ${{ steps.get-column.outputs.id }}
env:
GITHUB_TOKEN: ${{ secrets.GHPROJECT_TOKEN }}
36 changes: 36 additions & 0 deletions query-project-by-number.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
query($org: String!, $number: Int!) {
organization(login: $org) {
projectV2(number: $number) {
id
number
title
fields(first: 100) {
nodes {
__typename
... on ProjectV2Field {
id
name
}
... on ProjectV2IterationField {
id
name
configuration {
iterations {
startDate
id
}
}
}
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}
10 changes: 5 additions & 5 deletions update-project.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"labelToColumn": {
"0/pre-review-checks": "pre-review-checks",
"1-editor-assigned": "under-review",
"6/pyOS-approved 🚀🚀🚀": "pyos-accepted",
"9/joss-approved": "joss-accepted"
"labelToColumnId": {
"0/pre-review-checks": "f75ad846",
"1-editor-assigned": "fa21bd65",
"6/pyOS-approved 🚀🚀🚀": "4c9dbbd2",
"9/joss-approved": "ed99bc7a"
}
}

0 comments on commit 1fd9826

Please sign in to comment.