| 
 | 1 | +on:  | 
 | 2 | +  issue_comment:  | 
 | 3 | +    types: [created]  | 
 | 4 | + | 
 | 5 | +name: Add issues workflow labels  | 
 | 6 | + | 
 | 7 | +jobs:  | 
 | 8 | +  add-label-if-is-author:  | 
 | 9 | +    runs-on: ubuntu-latest  | 
 | 10 | +    if: (github.event.issue.user.id == github.event.comment.user.id) && !github.event.issue.pull_request && (github.event.issue.state == 'open')  | 
 | 11 | +    steps:  | 
 | 12 | +      - name: Add require handle label  | 
 | 13 | +        uses: actions-cool/issues-helper@v3  | 
 | 14 | +        with:  | 
 | 15 | +          actions: 'add-labels'  | 
 | 16 | +          labels: '🔔 Pending processing'  | 
 | 17 | + | 
 | 18 | +      - name: Remove require reply label  | 
 | 19 | +        uses: actions-cool/issues-helper@v3  | 
 | 20 | +        with:  | 
 | 21 | +          actions: 'remove-labels'  | 
 | 22 | +          labels: '⏳ Pending feedback'  | 
 | 23 | + | 
 | 24 | +  add-label-if-is-member:  | 
 | 25 | +    runs-on: ubuntu-latest  | 
 | 26 | +    steps:  | 
 | 27 | +      - name: Checkout repository  | 
 | 28 | +        uses: actions/checkout@v4  | 
 | 29 | + | 
 | 30 | +      - name: Get Organization name  | 
 | 31 | +        id: org_name  | 
 | 32 | +        run: echo "data=$(echo '${{ github.repository }}' | cut -d '/' -f 1)" >> $GITHUB_OUTPUT  | 
 | 33 | + | 
 | 34 | +      - name: Get Organization public members  | 
 | 35 | + | 
 | 36 | +        id: members  | 
 | 37 | +        with:  | 
 | 38 | +          route: GET /orgs/${{ steps.org_name.outputs.data }}/public_members  | 
 | 39 | +        env:  | 
 | 40 | +          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  | 
 | 41 | + | 
 | 42 | +      - name: Process public members data  | 
 | 43 | +        # 将 members 中的数据转化为 login 字段的拼接字符串  | 
 | 44 | +        id: member_names  | 
 | 45 | +        run: echo "data=$(echo '${{ steps.members.outputs.data }}' | jq '[.[].login] | join(",")')" >> $GITHUB_OUTPUT  | 
 | 46 | + | 
 | 47 | + | 
 | 48 | +      - run: "echo members: '${{ steps.members.outputs.data }}'"  | 
 | 49 | +      - run: "echo member names: '${{ steps.member_names.outputs.data }}'"  | 
 | 50 | +      - run: "echo comment user: '${{ github.event.comment.user.login }}'"  | 
 | 51 | +      - run: "echo contains? : '${{ contains(steps.member_names.outputs.data, github.event.comment.user.login) }}'"  | 
 | 52 | + | 
 | 53 | +      - name: Add require replay label  | 
 | 54 | +        if: contains(steps.member_names.outputs.data, github.event.comment.user.login)  | 
 | 55 | +        uses: actions-cool/issues-helper@v3  | 
 | 56 | +        with:  | 
 | 57 | +          actions: 'add-labels'  | 
 | 58 | +          labels: '⏳ Pending feedback'  | 
 | 59 | + | 
 | 60 | +      - name: Remove require handle label  | 
 | 61 | +        if: contains(steps.member_names.outputs.data, github.event.comment.user.login)  | 
 | 62 | +        uses: actions-cool/issues-helper@v3  | 
 | 63 | +        with:  | 
 | 64 | +          actions: 'remove-labels'  | 
 | 65 | +          labels: '🔔 Pending processing'  | 
0 commit comments