|
| 1 | +name: Notify public Github activity on Slack |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened, labeled, closed] |
| 6 | + issue_comment: |
| 7 | + types: [created] |
| 8 | + pull_request_target: |
| 9 | + types: [opened, reopened] |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +env: |
| 14 | + SLACK_CHANNEL_ID: "C05LEEK0N8J" |
| 15 | + ISSUE_EMOJI: ":ladybug:" |
| 16 | + PR_EMOJI: ":male-technologist:" |
| 17 | + MSG_TITLE: "[Public GitHub]" |
| 18 | + |
| 19 | +jobs: |
| 20 | + notify_new_issue: |
| 21 | + if: >- |
| 22 | + github.repository == 'quic/ai-hub-models' |
| 23 | + && github.event_name == 'issues' |
| 24 | + && github.event.action == 'opened' |
| 25 | + && !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.issue.author_association) |
| 26 | + name: Notify Slack - New Issue |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: slackapi/[email protected] |
| 30 | + with: |
| 31 | + channel-id: ${{ env.SLACK_CHANNEL_ID }} |
| 32 | + slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} New issue created: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>" |
| 33 | + env: |
| 34 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }} |
| 35 | + |
| 36 | + notify_new_issue_comment: |
| 37 | + if: >- |
| 38 | + github.repository == 'quic/ai-hub-models' |
| 39 | + && github.event_name == 'issue_comment' |
| 40 | + && !github.event.issue.pull_request |
| 41 | + && github.event.action == 'created' |
| 42 | + && !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association) |
| 43 | + name: Notify Slack - New Issue Comment |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: slackapi/[email protected] |
| 47 | + with: |
| 48 | + channel-id: ${{ env.SLACK_CHANNEL_ID }} |
| 49 | + slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} New issue comment: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>" |
| 50 | + env: |
| 51 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }} |
| 52 | + |
| 53 | + notify_stale_issues: |
| 54 | + if: >- |
| 55 | + github.repository == 'quic/ai-hub-models' |
| 56 | + && github.event_name == 'issues' |
| 57 | + && github.event.action == 'labeled' |
| 58 | + && github.event.label.name == 'stale' |
| 59 | + && github.actor == 'qaihm-bot' |
| 60 | + name: Notify Slack - Issue became Stale |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: slackapi/[email protected] |
| 64 | + with: |
| 65 | + channel-id: ${{ env.SLACK_CHANNEL_ID }} |
| 66 | + slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} An issue became stale:<${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>" |
| 67 | + env: |
| 68 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }} |
| 69 | + |
| 70 | + notify_closed_stale_issues: |
| 71 | + if: >- |
| 72 | + github.repository == 'quic/ai-hub-models' |
| 73 | + && github.event_name == 'issues' |
| 74 | + && github.event.action == 'closed' |
| 75 | + && github.actor == 'qaihm-bot' |
| 76 | + name: Notify Slack - Stale Issue Closed |
| 77 | + runs-on: ubuntu-latest |
| 78 | + steps: |
| 79 | + - uses: slackapi/[email protected] |
| 80 | + with: |
| 81 | + channel-id: ${{ env.SLACK_CHANNEL_ID }} |
| 82 | + slack-message: "${{ env.ISSUE_EMOJI }} ${{ env.MSG_TITLE }} A stale issue was auto-closed: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>}" |
| 83 | + env: |
| 84 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }} |
| 85 | + |
| 86 | + notify_new_pr: |
| 87 | + if: >- |
| 88 | + github.repository == 'quic/ai-hub-models' |
| 89 | + && github.event_name == 'pull_request_target' |
| 90 | + && github.event.action == 'opened' |
| 91 | + && !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association) |
| 92 | + name: Notify Slack - New PR Created |
| 93 | + runs-on: ubuntu-latest |
| 94 | + steps: |
| 95 | + - uses: slackapi/[email protected] |
| 96 | + with: |
| 97 | + channel-id: ${{ env.SLACK_CHANNEL_ID }} |
| 98 | + slack-message: "${{ env.PR_EMOJI }} ${{ env.MSG_TITLE }} New PR: <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>" |
| 99 | + env: |
| 100 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }} |
| 101 | + |
| 102 | + notify_new_pr_comment: |
| 103 | + if: >- |
| 104 | + github.repository == 'quic/ai-hub-models' |
| 105 | + && github.event_name == 'issue_comment' |
| 106 | + && github.event.issue.pull_request |
| 107 | + && github.event.action == 'created' |
| 108 | + && !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association) |
| 109 | + name: Notify Slack - New PR Comment |
| 110 | + runs-on: ubuntu-latest |
| 111 | + steps: |
| 112 | + - uses: slackapi/[email protected] |
| 113 | + with: |
| 114 | + channel-id: ${{ env.SLACK_CHANNEL_ID }} |
| 115 | + slack-message: "${{ env.PR_EMOJI }} ${{ env.MSG_TITLE }} New PR Comment: <${{ github.event.issue.pull_request.html_url }}|${{ github.event.issue.pull_request.title }}>" |
| 116 | + env: |
| 117 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_TOKEN }} |
0 commit comments