-
Notifications
You must be signed in to change notification settings - Fork 5
52 lines (41 loc) · 1.4 KB
/
on-roster-updated.yaml
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
name: On Roster Updated
on:
workflow_dispatch:
inputs:
gitHubIDs:
description: 'Comma delimited GitHub IDs'
required: true
permissions:
contents: read
id-token: write
issues: write
pull-requests: write
jobs:
verification-start:
name: 'Starting assignment'
runs-on: ubuntu-latest
steps:
- name: Check event payload
shell: pwsh
run: |
$eventPayload = '${{ toJson(github) }}'
- name: Get GitHub access token
id: github-connect
shell: pwsh
run: |
$ids = "${{ vars.ACCESS_TOKEN_IDS }}" -split ","
# Get a random number
$random = Get-Random -Minimum 0 -Maximum $ids.Length
# Get the random assignee
$id = $ids[$random]
$tokenUrl = "${{ vars.APIM_BASE_URL }}/github/access-token?id=$id"
Write-Host "Token URL: $tokenUrl"
$token = $(Invoke-RestMethod $tokenUrl -Headers @{ "Ocp-Apim-Subscription-Key" = "${{ secrets.APIM_SUBSCRIPTION_KEY }}" })
echo "::add-mask::$token"
echo "token=$token" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf-8
- name: Update inspectors
shell: bash
env:
GH_TOKEN: ${{ steps.github-connect.outputs.token }}
run: |
gh variable set INSPECTORS --body "${{ github.event.inputs.gitHubIDs }}" -R hackersground-kr/hackers-ground