1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2025-01-25 01:32:58 +02:00

Reenable pull request labeling (#11876)

This commit is contained in:
Álvaro Mondéjar Rubio 2024-09-27 16:06:46 +02:00 committed by GitHub
parent 2df7efad52
commit f708c4f6a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ on:
types: [opened, closed] types: [opened, closed]
jobs: jobs:
triage: add-labels:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: | if: |
github.event.action == 'opened' && github.event.action == 'opened' &&
@ -18,138 +18,139 @@ jobs:
- uses: simple-icons/labeler@v1 - uses: simple-icons/labeler@v1
with: with:
repo-token: ${{ steps.app-token.outputs.token }} repo-token: ${{ steps.app-token.outputs.token }}
# TODO: The next job has been temporarily disabled until the maintainers
# team decide to use projects board again.
# assign-to-project:
# runs-on: ubuntu-latest
# name: Assign to Project
# if: |
# github.event.action == 'opened' &&
# github.event.pull_request.base.ref != 'master'
# needs: add-labels
# steps:
# - uses: actions/create-github-app-token@v1
# id: app-token
# with:
# app-id: ${{ vars.BOT_APP_ID }}
# private-key: ${{ secrets.BOT_PRIVATE_KEY }}
assign-to-project: # - name: Checkout
runs-on: ubuntu-latest # uses: actions/checkout@v4
name: Assign to Project
if: |
github.event.action == 'opened' &&
github.event.pull_request.base.ref != 'master'
needs: triage
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout # - id: get-labels
uses: actions/checkout@v4 # uses: ./.github/actions/get-labels
# with:
# issue_number: ${{ github.event.pull_request.number }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
- id: get-labels # - id: get-si-members
uses: ./.github/actions/get-labels # name: Get simple-icons members
with: # run: |
issue_number: ${{ github.event.pull_request.number }} # 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/,$//')"
github-token: ${{ secrets.GITHUB_TOKEN }} # echo "members=$members" >> $GITHUB_OUTPUT
- id: get-si-members # - id: get-linked-issues
name: Get simple-icons members # name: Get linked issue numbers
run: | # uses: mondeja/pr-linked-issues-action@v2
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/,$//')" # with:
echo "members=$members" >> $GITHUB_OUTPUT # # 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}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: get-linked-issues # - id: priority-1
name: Get linked issue numbers # name: Assign `update icon/data` pull requests to "Priority 1"
uses: mondeja/pr-linked-issues-action@v2 # uses: srggrs/assign-one-project-github-action@1.3.1
with: # env:
# Lazy linked issues. If one of the lines of the pull request body # MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
# matches one of the next contents, the matching issue number will # if: contains(steps.get-labels.outputs.labels, 'update icon/data')
# be added to `issues` output: # with:
add_links_by_content: | # project: https://github.com/orgs/simple-icons/projects/2
**Issue:** #{issue_number} # column_name: Priority 1
**Issue**: #{issue_number}
**Close:** #{issue_number}
**Close**: #{issue_number}
**Closes:** #{issue_number}
**Closes**: #{issue_number}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: priority-1 # - id: priority-2
name: Assign `update icon/data` pull requests to "Priority 1" # name: Assign `new icon` pull requests to "Priority 2"
uses: srggrs/assign-one-project-github-action@1.3.1 # uses: srggrs/assign-one-project-github-action@1.3.1
env: # env:
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
if: contains(steps.get-labels.outputs.labels, 'update icon/data') # # the PR has the `new icon` label along with a linked issue and
with: # # the opener is not a member of simple-icons organization
project: https://github.com/orgs/simple-icons/projects/2 # if: |
column_name: Priority 1 # 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) == false
# with:
# project: https://github.com/orgs/simple-icons/projects/2
# column_name: Priority 2
- id: priority-2 # - id: priority-3
name: Assign `new icon` pull requests to "Priority 2" # name: Assign `new icon` pull requests by maintainers to "Priority 3"
uses: srggrs/assign-one-project-github-action@1.3.1 # uses: srggrs/assign-one-project-github-action@1.3.1
env: # env:
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
# the PR has the `new icon` label along with a linked issue and # # the PR has the `new icon` label along with a linked issue and
# the opener is not a member of simple-icons organization # # the opener is a member of the simple-icons organisation
if: | # if: |
contains(steps.get-labels.outputs.labels, 'new icon') && # contains(steps.get-labels.outputs.labels, 'new icon') &&
join(steps.get-linked-issues.outputs.issues) != '' && # join(steps.get-linked-issues.outputs.issues) != '' &&
contains(steps.get-si-members.outputs.members, github.event.pull_request.user.login) == false # contains(steps.get-si-members.outputs.members, github.event.pull_request.user.login) == true
with: # with:
project: https://github.com/orgs/simple-icons/projects/2 # project: https://github.com/orgs/simple-icons/projects/2
column_name: Priority 2 # column_name: Priority 3
- id: priority-3 # - id: priority-4
name: Assign `new icon` pull requests by maintainers to "Priority 3" # name: Assign `new icon` pull requests by maintainers without an issue to "Priority 4"
uses: srggrs/assign-one-project-github-action@1.3.1 # uses: srggrs/assign-one-project-github-action@1.3.1
env: # env:
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
# the PR has the `new icon` label along with a linked issue and # # the PR has the `new icon` label but with no linked issue and
# the opener is a member of the simple-icons organisation # # the opener is a member of the simple-icons organisation
if: | # if: |
contains(steps.get-labels.outputs.labels, 'new icon') && # contains(steps.get-labels.outputs.labels, 'new icon') &&
join(steps.get-linked-issues.outputs.issues) != '' && # join(steps.get-linked-issues.outputs.issues) == '' &&
contains(steps.get-si-members.outputs.members, github.event.pull_request.user.login) == true # contains(steps.get-si-members.outputs.members, github.event.pull_request.user.login) == true
with: # with:
project: https://github.com/orgs/simple-icons/projects/2 # project: https://github.com/orgs/simple-icons/projects/2
column_name: Priority 3 # column_name: Priority 4
- id: priority-4 # - name: Assign pull requests to "Unprioritised"
name: Assign `new icon` pull requests by maintainers without an issue to "Priority 4" # uses: srggrs/assign-one-project-github-action@1.3.1
uses: srggrs/assign-one-project-github-action@1.3.1 # env:
env: # MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # if: |
# the PR has the `new icon` label but with no linked issue and # steps.priority-1.conclusion == 'skipped' &&
# the opener is a member of the simple-icons organisation # steps.priority-2.conclusion == 'skipped' &&
if: | # steps.priority-3.conclusion == 'skipped' &&
contains(steps.get-labels.outputs.labels, 'new icon') && # steps.priority-4.conclusion == 'skipped'
join(steps.get-linked-issues.outputs.issues) == '' && # with:
contains(steps.get-si-members.outputs.members, github.event.pull_request.user.login) == true # project: https://github.com/orgs/simple-icons/projects/2
with: # column_name: Unprioritised
project: https://github.com/orgs/simple-icons/projects/2
column_name: Priority 4
- name: Assign pull requests to "Unprioritised" # unassign-from-project:
uses: srggrs/assign-one-project-github-action@1.3.1 # runs-on: ubuntu-latest
env: # name: Unassign from Project
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # if: |
if: | # github.event.action != 'opened' &&
steps.priority-1.conclusion == 'skipped' && # github.event.pull_request.merged == false &&
steps.priority-2.conclusion == 'skipped' && # github.event.pull_request.base.ref != 'master'
steps.priority-3.conclusion == 'skipped' && # steps:
steps.priority-4.conclusion == 'skipped' # - uses: actions/create-github-app-token@v1
with: # id: app-token
project: https://github.com/orgs/simple-icons/projects/2 # with:
column_name: Unprioritised # app-id: ${{ vars.BOT_APP_ID }}
# private-key: ${{ secrets.BOT_PRIVATE_KEY }}
unassign-from-project: # - name: Assign closed pull requests to "Completed or Abandoned"
runs-on: ubuntu-latest # uses: srggrs/assign-one-project-github-action@1.3.1
name: Unassign from Project # env:
if: | # MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
github.event.action != 'opened' && # with:
github.event.pull_request.merged == false && # project: https://github.com/orgs/simple-icons/projects/2
github.event.pull_request.base.ref != 'master' # column_name: Completed or Abandoned
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Assign closed pull requests to "Completed or Abandoned"
uses: srggrs/assign-one-project-github-action@1.3.1
env:
MY_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
project: https://github.com/orgs/simple-icons/projects/2
column_name: Completed or Abandoned