File tree 4 files changed +92
-6
lines changed
get-user-slack-from-email
4 files changed +92
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' davinci-github-actions ' : minor
3
+ ---
4
+
5
+ ---
6
+
7
+ ### get-user-slack-from-email
8
+
9
+ - add new github action
Original file line number Diff line number Diff line change
1
+ ## Get user slack from email
2
+
3
+ Get user slack handler based on user email
4
+
5
+ ### Description
6
+
7
+ This GH Action checks if user login belongs to the team member
8
+
9
+ ### Inputs
10
+
11
+ The list of arguments, that are used in GH Action:
12
+
13
+ | name | type | required | default | description |
14
+ | ----------------- | ------ | -------- | ------- | -------------------------------------------------------------------------------------------------------- |
15
+ | ` email ` | string | ✅ | | User email |
16
+ | ` slack-bot-token ` | string | ✅ | | Slack bot token with scope "users: read .email" ** Read-only** . If undefined, ` env.SLACK_BOT_TOKEN ` is used |
17
+
18
+ ### Outputs
19
+
20
+ The list of variables, that are returned by GH Action:
21
+
22
+ | name | type | description |
23
+ | -------------- | ------ | ------------- |
24
+ | ` slack-userId ` | string | Slack user id |
25
+
26
+ ### ENV Variables
27
+
28
+ All ENV Variables, defined in a GH Workflow are also passed to a GH Action. It means, the might be reused as is.
29
+ This is a list of ENV Variables that are used in GH Action:
30
+
31
+ | name | description |
32
+ | ----------------- | ------------------------------------------------------------ |
33
+ | ` SLACK_BOT_TOKEN ` | Slack bot token with scope "users: read .email" ** Read-only** . |
34
+
35
+ ### Usage
36
+
37
+ ``` yaml
38
+ - uses : toptal/davinci-github-actions/get-user-slack-from-email@v4.4.2
39
+ with :
40
+ email : tylerdurden@toptal.com
41
+ slack-bot-token : slack-bot-token
42
+ ` ` `
Original file line number Diff line number Diff line change
1
+ name : Get user slack from email
2
+ description : |
3
+ Get user slack handler based on user email
4
+ ****
5
+ envInputs:
6
+ SLACK_BOT_TOKEN: Slack bot token with scope "users:read.email" **Read-only**.
7
+ inputs :
8
+ email :
9
+ required : true
10
+ description : User email
11
+ slack-bot-token :
12
+ required : true
13
+ description : Slack bot token with scope "users:read.email" **Read-only**. If undefined, `env.SLACK_BOT_TOKEN` is used
14
+
15
+ outputs :
16
+ slack-userId :
17
+ description : " Slack user id"
18
+ value : ${{ steps.slack-user.outputs.slackId }}
19
+
20
+ runs :
21
+ using : composite
22
+ steps :
23
+ - name : Get slack user name
24
+ id : slack-user
25
+ shell : bash
26
+ env :
27
+ SLACK_BOT_TOKEN : ${{ inputs.slack-bot-token || env.SLACK_BOT_TOKEN }}
28
+ run : |
29
+ data=$(curl -X POST https://slack.com/api/users.lookupByEmail \
30
+ -H "Authorization: Bearer ${{ env.SLACK_BOT_TOKEN }}" \
31
+ -H "Content-Type: application/x-www-form-urlencoded" \
32
+ -d 'email=${{ inputs.email }}')
33
+ echo $data
34
+ slackId=$(echo $data | jq -r '.user.id')
35
+ echo "slackId=$slackId" >> $GITHUB_OUTPUT
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ Installs package dependencies. Caches `node_modules` for faster subsequent insta
10
10
11
11
The list of arguments, that are used in GH Action:
12
12
13
- | name | type | required | default | description |
14
- | --------------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------- |
15
- | ` npm-token ` | string | | | Access token type ** Read-only** . Required for repository with private dependencies. If undefined, ` env.NPM_TOKEN ` is used |
16
- | ` cache-version ` | string | | 0.0 | Cache version |
17
- | ` path ` | string | | . | Relative path under $GITHUB\_ WORKSPACE where to run ` yarn install ` command |
18
- | ` checkout-token ` | string | | | Repository checkout access token ` GITHUB_TOKEN ` . Required for self hosted runners command |
13
+ | name | type | required | default | description |
14
+ | ---------------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------- |
15
+ | ` npm-token ` | string | | | Access token type ** Read-only** . Required for repository with private dependencies. If undefined, ` env.NPM_TOKEN ` is used |
16
+ | ` cache-version ` | string | | 0.0 | Cache version |
17
+ | ` path ` | string | | . | Relative path under $GITHUB\_ WORKSPACE where to run ` yarn install ` command |
18
+ | ` checkout-token ` | string | | | Repository checkout access token ` GITHUB_TOKEN ` . Required for self hosted runners |
19
19
20
20
### Outputs
21
21
You can’t perform that action at this time.
0 commit comments