Skip to content

Commit

Permalink
Chore: Sync Language label on project with language label on the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fey101 committed Jun 12, 2024
1 parent 29f3356 commit 4620fa3
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion .github/workflows/project-auto-add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
- name: Set Language
- name: Set Language to Project
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
Expand All @@ -108,3 +108,42 @@ jobs:
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f language_field=$LANGUAGE_FIELD_ID -f language_value=${{ env.LANGUAGE_OPTION_ID }} --silent
- name: Get label for selected language in repository
if: ${{ env.SELECTED_LANGUAGE != 'Multiple Languages'}}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
gh api graphql -f query='
query($repoOwner: String!, $repoName: String!) {
repository(owner: $repoOwner, name: $repoName) {
id,
labels(first: 100) {
nodes{
id,
name
}
}
}
}' -f repoOwner=${{github.repository_owner}} -f repoName=${{github.event.repository.name}} > issue_data.json
echo 'LANGUAGELABEL_ID='$(jq --arg lang "$SELECTED_LANGUAGE" '.data.repository.labels.nodes[] | select(.name==$lang) | .id' issue_data.json) >> $GITHUB_ENV
- name: Add label to issue
if: ${{ env.SELECTED_LANGUAGE != 'Multiple Languages'}}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
ISSUE_ID: ${{ github.event_name == 'issues' && github.event.issue.node_id || github.event.pull_request.node_id }}
run: |
gh api graphql -f query='
mutation (
$issue: ID!
$label: ID!
) {
addLabelsToLabelable(input: {
labelableId: $issue
labelIds : [$label]
}) {
clientMutationId
}
}' -f issue=$ISSUE_ID -f label=$LANGUAGELABEL_ID --silent

0 comments on commit 4620fa3

Please sign in to comment.