Slack Invite Checker #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Slack Invite Checker" | |
on: | |
schedule: | |
- cron: '0 */6 * * *' # At minute 0 past every 6th hour. | |
workflow_dispatch: | |
env: | |
INVITE_LINK: 'https://slack.labelstudio.heartex.com/' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if the invite link is valid | |
run: | | |
! grep -Eo '("|")isSharedInviteError("|")\s*:\s*true' <( | |
curl --silent --location ${{ env.INVITE_LINK }} -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:96.0) Gecko/20100101 Firefox/96.0' -H "Accept: application/json" | |
) | |
- name: Notify to Slack | |
if: ${{ failure() }} | |
uses: slackapi/[email protected] | |
with: | |
channel-id: '${{ secrets.SLACK_LS_MONITORING_CHANNEL }}' | |
slack-message: "Our <${{ env.INVITE_LINK }}|public invite link> is down and needs to be manually updated:\n1. <https://slack.com/intl/en-es/help/articles/201330256-Invite-new-members-to-your-workspace#share-an-invite-link|Generate a new link> without expiry date; you may need to deactivate the previous one first.\n2. Update the permanent redirect link <https://s3.console.aws.amazon.com/s3/bucket/slack.labelstudio.heartex.com/property/website/edit?region=us-east-1|on the S3 dashboard> with newly generated link WITHOUT URL SCHEME." | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_LS_BOT_TOKEN }} |