| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- name: List Unhealthy Branches
- on:
- schedule:
- - cron: '0 16 * * wed'
- jobs:
- list:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 0
- - uses: actions/setup-node@v2-beta
- with:
- node-version: '14'
- - name: List branches
- id: list-branches
- run: |
- export SLACK_ATTACHMENTS_ILLEGAL=`node bin/github-actions/list-branches --illegal`
- export SLACK_ATTACHMENTS_INACTIVE=`node bin/github-actions/list-branches --inactive`
- echo ::set-output name=SLACK_ATTACHMENTS_ILLEGAL::$SLACK_ATTACHMENTS_ILLEGAL
- echo ::set-output name=SLACK_ATTACHMENTS_INACTIVE::$SLACK_ATTACHMENTS_INACTIVE
- echo ::set-output name=SLACK_ATTACHMENTS_LENGTH_ILLEGAL::$(echo $SLACK_ATTACHMENTS_ILLEGAL | jq '. | length')
- echo ::set-output name=SLACK_ATTACHMENTS_LENGTH_INACTIVE::$(echo $SLACK_ATTACHMENTS_INACTIVE | jq '. | length')
- - name: Slack Notification for illegal named branches
- if: steps.list-branches.outputs.SLACK_ATTACHMENTS_LENGTH_ILLEGAL > 0
- uses: tokorom/action-slack-incoming-webhook@master
- env:
- INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_DEV }}
- with:
- text: There is some *illegal named branches* on GitHub.
- attachments: ${{ steps.list-branches.outputs.SLACK_ATTACHMENTS_ILLEGAL }}
- - name: Slack Notification for inactive branches
- if: steps.list-branches.outputs.SLACK_ATTACHMENTS_LENGTH_INACTIVE > 0
- uses: tokorom/action-slack-incoming-webhook@master
- env:
- INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_DEV }}
- with:
- text: There is some *inactive branches* on GitHub.
- attachments: ${{ steps.list-branches.outputs.SLACK_ATTACHMENTS_INACTIVE }}
|