Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix update-project workflow #192

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
Loading