Documentation Roulette #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| # 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 |