From 5ca1825340f19faf6aa73028e82f0eb5e27b86c6 Mon Sep 17 00:00:00 2001 From: Jigar Rathod Date: Mon, 2 Oct 2023 16:53:22 +0530 Subject: [PATCH] Resolved Github actions Slack job failure Signed-off-by: Jigar Rathod --- .github/workflows/slack.yml | 41 ++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/.github/workflows/slack.yml b/.github/workflows/slack.yml index d492b4a..59902f7 100644 --- a/.github/workflows/slack.yml +++ b/.github/workflows/slack.yml @@ -1,17 +1,30 @@ -name: Notify slack -on: watch +name: Slack Notify +on: + watch: + types: [started] jobs: star-notify: - name: Notify slack on star - runs-on: ubuntu-latest + if: github.event_name == 'watch' + name: Notify Slack on star + runs-on: ubuntu-22.04 steps: - - name: Get current star count - run: | - echo ::set-env name=STARS::$(curl --silent 'https://api.github.com/repos/layer5io/learn-layer5' -H 'Accept: application/vnd.github.preview' | jq '.watchers_count') - - name: Notify slack - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - uses: pullreminders/slack-action@master - with: - args: '{\"channel\":\"CSK7N9TGX\",\"text\":\"${{ github.actor }} just starred Learn-Layer5! (https://github.com/layer5io/learn-layer5/stargazers) Total stars: ${{env.STARS}}\"}' - command: echo "Now at ${{env.STARS}} stars." + - name: Get current star count + run: | + echo "STARS=$(curl --silent 'https://api.github.com/repos/${{github.repository}}' -H 'Accept: application/vnd.github.preview' | jq '.stargazers_count')" >> $GITHUB_ENV + - name: Notify slack + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + uses: pullreminders/slack-action@master + with: + args: '{\"channel\":\"CSK7N9TGX\",\"text\":\"${{ github.actor }} just starred ${{github.repository}}! (https://github.com/${{github.repository}}/stargazers) Total ⭐️: ${{env.STARS}}\"}' + good-first-issue-notify: + if: github.event_name == 'issues' && github.event.label.name == 'good first issue' || github.event.label.name == 'first-timers-only' + name: Notify Slack for new good-first-issue + runs-on: ubuntu-22.04 + steps: + - name: Notify slack + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + uses: pullreminders/slack-action@master + with: + args: '{\"channel\":\"C019426UBNY\",\"text\":\"A good first issue label was just added to ${{github.event.issue.html_url}}.\"}'