From 3056f5e287726da25fbcfdc301c6c8dcb61ebe68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar?= Date: Wed, 29 Sep 2021 01:03:14 +0200 Subject: [PATCH] Auto assign pull requests to 'Priority 2' column (#6615) * Auto assign pull requests to 'Priority 2' column * Update 'pr-linked-issues-action' to v2 --- .github/workflows/add-labels-priority.yml | 63 +++++++++++++++++------ 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/.github/workflows/add-labels-priority.yml b/.github/workflows/add-labels-priority.yml index eeb1e87d..27f2f03e 100644 --- a/.github/workflows/add-labels-priority.yml +++ b/.github/workflows/add-labels-priority.yml @@ -18,22 +18,51 @@ jobs: env: MY_GITHUB_TOKEN: ${{ secrets.AUTO_ASSIGN_WORKFLOW_TOKEN }} steps: - - id: get-labels - name: Get labels - run: | - labels="$(curl --retry 5 -s https://api.github.com/repos/simple-icons/simple-icons/pulls/${{ github.event.pull_request.number }} | jq '.labels[].name' | tr '\n' ',' | sed 's/"//g' | sed 's/,$//')" - echo "::set-output name=labels::$labels" + steps: + - id: get-labels + name: Get labels + run: | + labels="$(curl --retry 5 -s https://api.github.com/repos/simple-icons/simple-icons/pulls/${{ github.event.pull_request.number }} | jq '.labels[].name' | tr '\n' ',' | sed -e 's/"//g' -e 's/,$//')" + echo "::set-output name=labels::$labels" - - name: Assign pull requests to "Unprioritised" - uses: srggrs/assign-one-project-github-action@1.2.1 - if: contains(steps.get-labels.outputs.labels, 'icon outdated') == false - with: - project: https://github.com/orgs/simple-icons/projects/2 - column_name: Unprioritised + - id: get-si-members + name: Get simple-icons members + run: | + members="$(curl --retry 5 -s https://api.github.com/orgs/simple-icons/members | jq .[].login | tr '\n' ',' | sed -e 's/"//g' -e 's/,$//')" + echo "::set-output name=members::$members" - - name: Assign `icon outdated` pull requests to "Priority 1" - uses: srggrs/assign-one-project-github-action@1.2.1 - if: contains(steps.get-labels.outputs.labels, 'icon outdated') - with: - project: https://github.com/orgs/simple-icons/projects/2 - column_name: Priority 1 + - id: get-linked-issues + name: Get linked issue numbers + uses: mondeja/pr-linked-issues-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - id: priority-1 + name: Assign `icon outdated` pull requests to "Priority 1" + uses: srggrs/assign-one-project-github-action@1.2.1 + if: contains(steps.get-labels.outputs.labels, 'icon outdated') + with: + project: https://github.com/orgs/simple-icons/projects/2 + column_name: Priority 1 + + - id: priority-2 + name: Assign `new icon` pull requests to "Priority 2" + uses: srggrs/assign-one-project-github-action@1.2.1 + # the PR has the `new icon` label along with a linked issue and + # the opener is not a member of simple-icons organization + if: | + contains(steps.get-labels.outputs.labels, 'new icon') && + join(steps.get-linked-issues.outputs.issues) != '' && + contains(steps.get-si-members.outputs.members, github.event.actor.login) == false + with: + project: https://github.com/orgs/simple-icons/projects/2 + column_name: Priority 2 + + - name: Assign pull requests to "Unprioritised" + uses: srggrs/assign-one-project-github-action@1.2.1 + if: | + steps.priority-1.conclusion == 'skipped' && + steps.priority-2.conclusion == 'skipped' + with: + project: https://github.com/orgs/simple-icons/projects/2 + column_name: Unprioritised