Skip to content

On Roster Updated

On Roster Updated #1

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.ACCESS_TOKEN_BASE_URL }}/access-token?id=$id"
$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
run: |
gh variable set INSPECTORS --body "${{ github.event.inputs.gitHubIDs }}" -R hackersground-kr/hackers-ground