-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (51 loc) · 1.49 KB
/
add-to-github-group.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
name: add-to-github-group
on:
workflow_call:
inputs:
team_slug:
required: true
type: string
previous_team_slug:
required: false
type: string
github_handle:
required: true
type: string
secrets:
PAT:
required: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: add_to_team
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
github.rest.teams.addOrUpdateMembershipForUserInOrg({
org: "${{ github.repository_owner }}",
team_slug: "${{ inputs.team_slug }}",
username: "${{ inputs.github_handle }}"
})
- name: remove_from_previous_team
if: ${{ inputs.previous_team_slug }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
github.rest.teams.removeMembershipForUserInOrg({
org: "${{ github.repository_owner }}",
team_slug: "${{ inputs.previous_team_slug }}",
username: "${{ inputs.github_handle }}"
})
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["github"]
})