2021-09-27 18:02:06 +02:00
|
|
|
name: Add Pull Request Labels and Assign to Project
|
2021-09-27 16:57:34 +02:00
|
|
|
on:
|
|
|
|
pull_request_target:
|
2022-02-07 11:24:48 +02:00
|
|
|
types: [opened, closed]
|
2021-09-27 16:57:34 +02:00
|
|
|
|
|
|
|
jobs:
|
2021-09-27 18:02:06 +02:00
|
|
|
triage:
|
|
|
|
runs-on: ubuntu-latest
|
2022-02-07 11:24:48 +02:00
|
|
|
if: github.event.action == 'opened'
|
2021-09-27 18:02:06 +02:00
|
|
|
steps:
|
2024-03-28 23:31:27 +02:00
|
|
|
- uses: actions/create-github-app-token@v1
|
|
|
|
id: app-token
|
|
|
|
with:
|
|
|
|
app-id: ${{ vars.BOT_APP_ID }}
|
|
|
|
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
2024-03-10 05:13:51 +02:00
|
|
|
- uses: simple-icons/labeler@v1
|
2021-09-27 18:02:06 +02:00
|
|
|
with:
|
2024-03-28 23:31:27 +02:00
|
|
|
repo-token: ${{ steps.app-token.outputs.token }}
|
2021-09-27 18:02:06 +02:00
|
|
|
|
2021-09-27 16:57:34 +02:00
|
|
|
assign-to-project:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Assign to Project
|
2022-02-07 11:24:48 +02:00
|
|
|
if: github.event.action == 'opened'
|
2021-09-27 18:02:06 +02:00
|
|
|
needs: triage
|
2021-09-29 01:03:14 +02:00
|
|
|
steps:
|
2024-03-28 23:31:27 +02:00
|
|
|
- uses: actions/create-github-app-token@v1
|
|
|
|
id: app-token
|
|
|
|
with:
|
|
|
|
app-id: ${{ vars.BOT_APP_ID }}
|
|
|
|
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
|
|
|
2023-11-06 11:11:50 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2021-09-29 01:03:14 +02:00
|
|
|
- id: get-labels
|
2023-11-05 21:35:53 +02:00
|
|
|
uses: ./.github/actions/get-labels
|
2023-10-28 21:31:47 +02:00
|
|
|
with:
|
|
|
|
issue_number: ${{ github.event.pull_request.number }}
|
2023-11-07 22:28:43 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-09-29 01:03:14 +02:00
|
|
|
|
|
|
|
- id: get-si-members
|
|
|
|
name: Get simple-icons members
|
|
|
|
run: |
|
2024-03-28 23:31:27 +02:00
|
|
|
members="$(curl -H 'Authorization: Bearer ${{ steps.app-token.outputs.token }}' --retry 5 -s https://api.github.com/orgs/simple-icons/members | jq .[].login | tr '\n' ',' | sed -e 's/"//g' -e 's/,$//')"
|
2023-02-09 21:18:10 +02:00
|
|
|
echo "members=$members" >> $GITHUB_OUTPUT
|
2021-09-27 20:03:19 +02:00
|
|
|
|
2021-09-29 01:03:14 +02:00
|
|
|
- id: get-linked-issues
|
|
|
|
name: Get linked issue numbers
|
|
|
|
uses: mondeja/pr-linked-issues-action@v2
|
2021-12-27 21:37:18 +02:00
|
|
|
with:
|
|
|
|
# Lazy linked issues. If one of the lines of the pull request body
|
|
|
|
# matches one of the next contents, the matching issue number will
|
|
|
|
# be added to `issues` output:
|
|
|
|
add_links_by_content: |
|
|
|
|
**Issue:** #{issue_number}
|
|
|
|
**Issue**: #{issue_number}
|
|
|
|
**Close:** #{issue_number}
|
|
|
|
**Close**: #{issue_number}
|
|
|
|
**Closes:** #{issue_number}
|
|
|
|
**Closes**: #{issue_number}
|
2021-09-29 01:03:14 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- id: priority-1
|
2023-12-05 14:50:14 +02:00
|
|
|
name: Assign `update icon/data` pull requests to "Priority 1"
|
2021-10-11 05:53:19 +02:00
|
|
|
uses: srggrs/assign-one-project-github-action@1.3.1
|
2024-03-28 23:31:27 +02:00
|
|
|
env:
|
|
|
|
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
2023-12-05 14:50:14 +02:00
|
|
|
if: contains(steps.get-labels.outputs.labels, 'update icon/data')
|
2021-09-29 01:03:14 +02:00
|
|
|
with:
|
|
|
|
project: https://github.com/orgs/simple-icons/projects/2
|
|
|
|
column_name: Priority 1
|
2021-09-27 16:57:34 +02:00
|
|
|
|
2021-09-29 01:03:14 +02:00
|
|
|
- id: priority-2
|
|
|
|
name: Assign `new icon` pull requests to "Priority 2"
|
2021-10-11 05:53:19 +02:00
|
|
|
uses: srggrs/assign-one-project-github-action@1.3.1
|
2024-03-28 23:31:27 +02:00
|
|
|
env:
|
|
|
|
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
2021-09-29 01:03:14 +02:00
|
|
|
# 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) != '' &&
|
2023-07-23 22:22:46 +02:00
|
|
|
contains(steps.get-si-members.outputs.members, github.event.pull_request.user.login) == false
|
2021-09-29 01:03:14 +02:00
|
|
|
with:
|
|
|
|
project: https://github.com/orgs/simple-icons/projects/2
|
|
|
|
column_name: Priority 2
|
|
|
|
|
2023-08-30 14:41:32 +02:00
|
|
|
- id: priority-3
|
|
|
|
name: Assign `new icon` pull requests by maintainers to "Priority 3"
|
|
|
|
uses: srggrs/assign-one-project-github-action@1.3.1
|
2024-03-28 23:31:27 +02:00
|
|
|
env:
|
|
|
|
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
2023-08-30 14:41:32 +02:00
|
|
|
# the PR has the `new icon` label along with a linked issue and
|
|
|
|
# the opener is a member of the simple-icons organisation
|
|
|
|
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.pull_request.user.login) == true
|
|
|
|
with:
|
|
|
|
project: https://github.com/orgs/simple-icons/projects/2
|
|
|
|
column_name: Priority 3
|
|
|
|
|
|
|
|
- id: priority-4
|
|
|
|
name: Assign `new icon` pull requests by maintainers without an issue to "Priority 4"
|
2023-08-30 21:37:17 +02:00
|
|
|
uses: srggrs/assign-one-project-github-action@1.3.1
|
2024-03-28 23:31:27 +02:00
|
|
|
env:
|
|
|
|
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
2023-08-30 14:41:32 +02:00
|
|
|
# the PR has the `new icon` label but with no linked issue and
|
|
|
|
# the opener is a member of the simple-icons organisation
|
|
|
|
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.pull_request.user.login) == true
|
|
|
|
with:
|
|
|
|
project: https://github.com/orgs/simple-icons/projects/2
|
|
|
|
column_name: Priority 4
|
|
|
|
|
2021-09-29 01:03:14 +02:00
|
|
|
- name: Assign pull requests to "Unprioritised"
|
2021-10-11 05:53:19 +02:00
|
|
|
uses: srggrs/assign-one-project-github-action@1.3.1
|
2024-03-28 23:31:27 +02:00
|
|
|
env:
|
|
|
|
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
2021-09-29 01:03:14 +02:00
|
|
|
if: |
|
|
|
|
steps.priority-1.conclusion == 'skipped' &&
|
2023-08-30 14:41:32 +02:00
|
|
|
steps.priority-2.conclusion == 'skipped' &&
|
|
|
|
steps.priority-3.conclusion == 'skipped' &&
|
|
|
|
steps.priority-4.conclusion == 'skipped'
|
2021-09-29 01:03:14 +02:00
|
|
|
with:
|
|
|
|
project: https://github.com/orgs/simple-icons/projects/2
|
|
|
|
column_name: Unprioritised
|
2022-02-07 11:24:48 +02:00
|
|
|
|
|
|
|
unassign-from-project:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Unassign from Project
|
|
|
|
if: |
|
|
|
|
github.event.action != 'opened' &&
|
|
|
|
github.event.pull_request.merged == false
|
|
|
|
steps:
|
2024-03-28 23:31:27 +02:00
|
|
|
- uses: actions/create-github-app-token@v1
|
|
|
|
id: app-token
|
|
|
|
with:
|
|
|
|
app-id: ${{ vars.BOT_APP_ID }}
|
|
|
|
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
2022-02-07 11:24:48 +02:00
|
|
|
- name: Assign closed pull requests to "Completed or Abandoned"
|
|
|
|
uses: srggrs/assign-one-project-github-action@1.3.1
|
2024-03-28 23:31:27 +02:00
|
|
|
env:
|
|
|
|
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
2022-02-07 11:24:48 +02:00
|
|
|
with:
|
|
|
|
project: https://github.com/orgs/simple-icons/projects/2
|
|
|
|
column_name: Completed or Abandoned
|