forked from secureCodeBox/secureCodeBox
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.73 KB
/
documentation-roulette.yaml
File metadata and controls
49 lines (42 loc) · 1.73 KB
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
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
# Some parts copied and modified from https://github.com/garnertb/get-team-members/ Copyright (c) 2022 Tyler Garner
name: Documentation Roulette
on:
schedule:
- cron: "0 12 15 * *" # At 12:00 UTC on day-of-month 15
permissions:
contents: read
issues: write
jobs:
docu-roulette:
permissions:
issues: write # needed to create new issues
runs-on: ubuntu-24.04
if: github.repository == 'secureCodeBox/secureCodeBox'
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# Request team members with the GitHub API using their gh cli
- name: Fetch core-team members
id: fetch-members
run: |
echo MEMBERS=$(gh api --paginate -X GET /orgs/$ORG/teams/$TEAM_SLUG/members | jq 'reduce inputs as $i (.; . += $i)') >> $GITHUB_OUTPUT
env:
ORG: secureCodeBox
TEAM_SLUG: core-team
GH_TOKEN: ${{ secrets.SCB_BOT_DOCU_ROULETTE_TOKEN }} # Token used here needs org:read permission
# Select random member from team response
- name: Select the chosen member
run: |
MEMBERS=(${{ join(fromJson(steps.fetch-members.outputs.MEMBERS).*.login, ' ') }})
size=${#MEMBERS[@]}
index=$(($RANDOM % $size))
echo "MEMBER=${MEMBERS[$index]}" >> $GITHUB_ENV
# Create issue and insert chosen member ({{ env.MEMBER}} in template)
- uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/ISSUE_TEMPLATE/documentation_roulette.md