bug: Entries in flex database which have morph type "bound root" have the Word field blank in language forge #209
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
name: Add Issue to Project | |
on: | |
issues: | |
types: [ opened, reopened ] | |
jobs: | |
add_issue_to_project: | |
if: ${{ !github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: ${{ secrets.LFPROJECTBOARDAUTOMATION_APP_ID }} | |
private_key: ${{ secrets.LFPROJECTBOARDAUTOMATION_PRIVATE_KEY }} | |
- name: determine if issue is already on a project | |
env: | |
ISSUE_NUMBER: ${{ github.event.issue.number }} | |
REPO: ${{ toJson(github.event.repository.name) }} | |
ORGANIZATION: sillsdev | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
echo issue $ISSUE_NUMBER added to $REPO | |
gh api graphql -f query=' | |
query($issue_number:Int!, $org:String!) { | |
repository(name:"web-languageforge", owner:$org) { | |
issue(number: $issue_number) { | |
id | |
projectItems(first:100) { | |
nodes { | |
id | |
} | |
} | |
} | |
} | |
}' -F issue_number=$ISSUE_NUMBER -f org=$ORGANIZATION > project_data.json | |
echo 'IN_PROJECT='$(jq '.data.repository.issue.projectItems[] | length' project_data.json) >> $GITHUB_ENV | |
- name: get required info for set operations | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
ORGANIZATION: sillsdev | |
run: | | |
gh api graphql -f query=' | |
query ($org: String!) { | |
organization(login: $org) { | |
projectV2(number: 1) { | |
id | |
field(name: "ProductOwner") { | |
... on ProjectV2SingleSelectField { | |
id | |
name | |
options { | |
id | |
name | |
} | |
} | |
} | |
} | |
} | |
}' -f org=$ORGANIZATION > project_data.json | |
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV | |
echo 'FIELD_ID='$(jq '.data.organization.projectV2.field.id' project_data.json) >> $GITHUB_ENV | |
echo 'INCOMING_ID='$(jq '.data.organization.projectV2.field.options[] | select(.name=="Incoming") | .id' project_data.json) >> $GITHUB_ENV | |
- name: Add issue to project | |
if: env.IN_PROJECT == 0 | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
ISSUE_ID: ${{ github.event.issue.node_id }} #use ITEM_ID instead for finding on projects | |
run: | | |
item_id="$( gh api graphql -f query=' | |
mutation($project:ID!, $item:ID!) { | |
addProjectV2ItemById(input: {projectId: $project, contentId: $item}) { | |
item { | |
id | |
} | |
} | |
}' -f project=$PROJECT_ID -f item=$ISSUE_ID --jq '.data.addProjectV2ItemById.item.id')" | |
echo 'ITEM_ID='$item_id >> $GITHUB_ENV | |
- name: set project field | |
if: env.IN_PROJECT == 0 | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
gh api graphql -f query=' | |
mutation( | |
$project:ID! | |
$item:ID! | |
$field: ID! | |
$field_value: String!) | |
{ | |
updateProjectV2ItemFieldValue(input: { | |
projectId: $project | |
itemId: $item | |
fieldId: $field | |
value: { | |
singleSelectOptionId: $field_value | |
} | |
} | |
) | |
{ | |
projectV2Item { | |
id | |
} | |
} | |
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f field=$FIELD_ID -f field_value=${{ env.INCOMING_ID }} | |