Broken link to specifications #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub action that automatically adds newly filed issues to the Lit project. | |
# | |
# Based on the example at | |
# https://docs.github.com/en/issues/trying-out-the-new-projects-experience/automating-projects#example-workflow-authenticating-with-a-personal-access-token | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
add-issue-to-project: | |
# Don't run on forks. Issues on forks aren't relevant, and secrets aren't | |
# available anyway. | |
if: github.repository == 'webcomponents/webcomponents.org' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add issue to project | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIT_ROBOT_AUTOMATION_PAT }} | |
# The project ID can be found by running the following query at | |
# https://docs.github.com/en/graphql/overview/explorer | |
# | |
# { | |
# organization(login: "lit") { | |
# projectV2(number: 4) { | |
# id | |
# } | |
# } | |
# } | |
PROJECT_ID: PVT_kwDOARoh9s4AAixo | |
# Note: issue.url is the REST API url, but we want issue.html_url | |
# which is the regular public URL. | |
ISSUE_URL: ${{ github.event.issue.html_url }} | |
# The addProjectV2ItemById API refuses to add an issue to a project | |
# unless the issue is in the same org as the project -- even though it's | |
# possible to do so through the UI. However, it turns out if you set the | |
# URL as the title using the addProjectV2DraftIssue API, that does the | |
# right thing! | |
run: | | |
gh api graphql -f query=' | |
mutation($project_id:ID!, $issue_url:String!) { | |
addProjectV2DraftIssue(input: {projectId: $project_id, title: $issue_url}) { | |
projectItem { | |
id | |
} | |
} | |
}' -f project_id=$PROJECT_ID -f issue_url=$ISSUE_URL > item.json | |
echo 'ITEM_ID='$(jq '.data.addProjectV2DraftIssue.projectItem.id' item.json) >> $GITHUB_ENV | |
- name: Add area to item | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIT_ROBOT_AUTOMATION_PAT }} | |
PROJECT_ID: PVT_kwDOARoh9s4AAixo | |
# Field and value IDs can be found by running the following query at | |
# https://docs.github.com/en/graphql/overview/explorer | |
# | |
# { | |
# node(id: "PVT_kwDOARoh9s4AAixo") { | |
# ... on ProjectV2 { | |
# fields(first: 100) { | |
# nodes { | |
# ... on ProjectV2Field { | |
# id | |
# name | |
# } | |
# ... on ProjectV2IterationField { | |
# id | |
# name | |
# configuration { | |
# iterations { | |
# startDate | |
# id | |
# } | |
# } | |
# } | |
# ... on ProjectV2SingleSelectField { | |
# id | |
# name | |
# options { | |
# id | |
# name | |
# } | |
# } | |
# } | |
# } | |
# } | |
# } | |
# } | |
FIELD_ID: PVTSSF_lADOARoh9s4AAixozgASjcA # Area | |
VALUE_ID: 9a4cb01d # webcomponents.org | |
run: | | |
gh api graphql -f query=' | |
mutation ($project_id: ID!, $item_id: ID!, $field_id: ID!, $value_id: String!) { | |
updateProjectV2ItemFieldValue( | |
input: {projectId: $project_id, itemId: $item_id, fieldId: $field_id, value: {singleSelectOptionId: $value_id}} | |
) { | |
clientMutationId | |
} | |
}' -f project_id=$PROJECT_ID -f item_id=$ITEM_ID -f field_id=$FIELD_ID -f value_id=$VALUE_ID |