solidity/.github/workflows/triage.yml
Rodrigo Q. Saramago c47d3cd00f
Disable dry-run
2022-10-24 11:56:56 -03:00

62 lines
2.1 KiB
YAML

name: Add new issues to triage column
on:
issues:
types:
- opened
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORGANIZATION: ethereum
REPOSITORY: solidity
PROJECT_NUMBER: 43
DRY_RUN: false
jobs:
triage_issues:
runs-on: ubuntu-latest
if: join(github.event.issue.labels) == ''
steps:
- name: Retrieve the content of all columns on the board
run: |
gh api graphql \
--raw-field owner="$ORGANIZATION" \
--field project_number="$PROJECT_NUMBER" \
--raw-field repository_name="$REPOSITORY" \
--raw-field query='
query($owner: String!, $repository_name: String!, $project_number: Int!) {
repository(owner: $owner, name: $repository_name) {
project(number: $project_number) {
columns(first: 10) {
nodes {
id,
name
}
}
}
}
}' > project_columns.json
echo 'COLUMN_ID='$(jq '.data.repository.project.columns.nodes[] | select(.name == "Triage") | .id' project_columns.json) >> $GITHUB_ENV
echo 'COLUMN_NAME='$(jq '.data.repository.project.columns.nodes[] | select(.name == "Triage") | .name' project_columns.json) >> $GITHUB_ENV
- name: Add issue#${{ github.event.issue.number }} to Triage column
env:
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
echo "Adding issue: ${{ github.event.issue.number }} to column $COLUMN_NAME in project $PROJECT_NUMBER"
if [[ $DRY_RUN == "false" ]]; then
gh api graphql \
--silent \
--raw-field column=$COLUMN_ID \
--raw-field issue=$ISSUE_ID \
--raw-field query='
mutation($column: ID!, $issue: ID!) {
addProjectCard(input: {
projectColumnId: $column,
contentId: $issue
}) {
clientMutationId
}
}'
fi