generated from austenstone/action-typescript
-
-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (55 loc) · 1.72 KB
/
slack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Slack
permissions: {}
on:
workflow_call:
inputs:
org:
required: true
description: The organization to check seats.
type: string
slack-channel-id:
required: true
description: The Slack channel id, channel name, or user id to post message.
type: string
seats-remaining:
required: false
default: 10
description: The number of seats that triggers the message
type: number
outputs:
percentage:
value: ${{ jobs.seats.outputs.percentage }}
description: The percentage of seats used
remaining:
value: ${{ jobs.seats.outputs.remaining }}
description: The number of seats remaining
secrets:
github-token:
required: false
description: GitHub PAT
slack-bot-token:
required: false
description: Slack bot token
jobs:
seats:
name: Get Seats Remaining
runs-on: ubuntu-latest
steps:
- name: Get Seats Remaining
uses: austenstone/seat-count-action@main
id: seats
with:
org: ${{ inputs.org }}
github-token: ${{ secrets.github-token }}
- name: Print
run: |
echo "${{ steps.seats.outputs.percentage }}% of seats used."
echo "${{ steps.seats.outputs.remaining }} seats remaining"
- name: Post to a Slack channel
if: steps.seats.outputs.remaining <= inputs.seats-remaining
uses: slackapi/[email protected]
with:
channel-id: ${{ inputs.slack-channel-id }}
slack-message: "Only ${{ steps.seats.outputs.remaining }} GitHub seats remaining!"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}