mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-07-02 23:23:21 +00:00
65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
name: Add issues workflow labels
|
|
|
|
jobs:
|
|
add-label-if-is-author:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
if: >
|
|
(github.event.issue.user.id == github.event.comment.user.id) &&
|
|
!github.event.issue.pull_request &&
|
|
(github.event.issue.state == 'open')
|
|
|
|
steps:
|
|
- name: Update labels
|
|
run: |
|
|
gh issue edit "${{ github.event.issue.number }}" \
|
|
--add-label "🔔 Pending processing" \
|
|
--remove-label "⏳ Pending feedback"
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
add-label-if-is-member:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get Organization name
|
|
id: org_name
|
|
run: echo "data=$(echo '${{ github.repository }}' | cut -d '/' -f 1)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get Organization public members
|
|
uses: octokit/request-action@v2.x
|
|
id: members
|
|
with:
|
|
route: GET /orgs/${{ steps.org_name.outputs.data }}/public_members
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Process public members data
|
|
# 将 members 中的数据转化为 login 字段的拼接字符串
|
|
id: member_names
|
|
run: echo "data=$(echo '${{ steps.members.outputs.data }}' | jq '[.[].login] | join(",")')" >> $GITHUB_OUTPUT
|
|
|
|
|
|
- run: "echo members: '${{ steps.members.outputs.data }}'"
|
|
- run: "echo member names: '${{ steps.member_names.outputs.data }}'"
|
|
- run: "echo comment user: '${{ github.event.comment.user.login }}'"
|
|
- run: "echo contains? : '${{ contains(steps.member_names.outputs.data, github.event.comment.user.login) }}'"
|
|
|
|
- name: Update labels
|
|
if: contains(steps.member_names.outputs.data, github.event.comment.user.login)
|
|
run: |
|
|
gh issue edit "${{ github.event.issue.number }}" \
|
|
--add-label "⏳ Pending feedback" \
|
|
--remove-label "🔔 Pending processing"
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|