list-unhealthy-branches.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: List Unhealthy Branches
  2. on:
  3. schedule:
  4. - cron: '0 16 * * wed'
  5. jobs:
  6. list:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - uses: actions/checkout@v2
  10. with:
  11. fetch-depth: 0
  12. - uses: actions/setup-node@v2-beta
  13. with:
  14. node-version: '14'
  15. - name: List branches
  16. id: list-branches
  17. run: |
  18. export SLACK_ATTACHMENTS_ILLEGAL=`node bin/github-actions/list-branches --illegal`
  19. export SLACK_ATTACHMENTS_INACTIVE=`node bin/github-actions/list-branches --inactive`
  20. echo ::set-output name=SLACK_ATTACHMENTS_ILLEGAL::$SLACK_ATTACHMENTS_ILLEGAL
  21. echo ::set-output name=SLACK_ATTACHMENTS_INACTIVE::$SLACK_ATTACHMENTS_INACTIVE
  22. echo ::set-output name=SLACK_ATTACHMENTS_LENGTH_ILLEGAL::$(echo $SLACK_ATTACHMENTS_ILLEGAL | jq '. | length')
  23. echo ::set-output name=SLACK_ATTACHMENTS_LENGTH_INACTIVE::$(echo $SLACK_ATTACHMENTS_INACTIVE | jq '. | length')
  24. - name: Slack Notification for illegal named branches
  25. if: steps.list-branches.outputs.SLACK_ATTACHMENTS_LENGTH_ILLEGAL > 0
  26. uses: tokorom/action-slack-incoming-webhook@master
  27. env:
  28. INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_DEV }}
  29. with:
  30. text: There is some *illegal named branches* on GitHub.
  31. attachments: ${{ steps.list-branches.outputs.SLACK_ATTACHMENTS_ILLEGAL }}
  32. - name: Slack Notification for inactive branches
  33. if: steps.list-branches.outputs.SLACK_ATTACHMENTS_LENGTH_INACTIVE > 0
  34. uses: tokorom/action-slack-incoming-webhook@master
  35. env:
  36. INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_DEV }}
  37. with:
  38. text: There is some *inactive branches* on GitHub.
  39. attachments: ${{ steps.list-branches.outputs.SLACK_ATTACHMENTS_INACTIVE }}