-
Notifications
You must be signed in to change notification settings - Fork 8.2k
62 lines (55 loc) · 1.95 KB
/
oblt-github-commands.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
57
58
59
60
61
62
---
##
## This the automation to let Observability team members to know what are the
## supported GitHub commands to interact with the Observability test environments.
##
## Owner: @elastic/observablt-robots
##
name: oblt-github-commands
on:
pull_request_target:
types:
- opened
permissions:
contents: read
jobs:
comment-if-oblt-member:
runs-on: ubuntu-latest
steps:
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current
with:
url: ${{ secrets.OBLT_VAULT_ADDR }}
roleId: ${{ secrets.OBLT_VAULT_ROLE_ID }}
secretId: ${{ secrets.OBLT_VAULT_SECRET_ID }}
- id: is_team_member
name: Check if user is member of the Elastic org and Observability team
run: |
if gh api -H "Accept: application/vnd.github+json" \
/orgs/elastic/teams/observability/memberships/${{ github.actor }} ; then
echo "result=true" >> $GITHUB_OUTPUT
else
echo "result=false" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
- if: ${{ steps.is_team_member.outputs.result == 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const body = `
### :robot: GitHub comments
<details><summary>Expand to view the GitHub comments</summary>
<p>
Just comment with:
- \`/oblt-deploy\` : Deploy a Kibana instance using the Observability test environments.
- \`run\` \`docs-build\` : Re-trigger the docs validation. (use unformatted text in the comment!)
</p>
</details>
`.replace(/ +/g, '')
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})