From 33817237e2480b83c216615c333262179b6bc055 Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Thu, 14 Sep 2023 12:38:55 +0200 Subject: [PATCH 1/2] Add action which creates a documentation issue on the 15th of each month Signed-off-by: Heiko Kiesel --- .../ISSUE_TEMPLATE/documentation_roulette.md | 5 +++ .github/workflows/documentation-roulette.yaml | 45 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/documentation_roulette.md create mode 100644 .github/workflows/documentation-roulette.yaml diff --git a/.github/ISSUE_TEMPLATE/documentation_roulette.md b/.github/ISSUE_TEMPLATE/documentation_roulette.md new file mode 100644 index 0000000000..0464d9efd5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_roulette.md @@ -0,0 +1,5 @@ +--- +title: "📚 Recurring documentation issue" +labels: documentation +--- +Congratulations @{{ env.MEMBER }}, you were randomly selected to review our documentation for 2h. Have fun 😉 \ No newline at end of file diff --git a/.github/workflows/documentation-roulette.yaml b/.github/workflows/documentation-roulette.yaml new file mode 100644 index 0000000000..08ecacc289 --- /dev/null +++ b/.github/workflows/documentation-roulette.yaml @@ -0,0 +1,45 @@ +# 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 + +jobs: + docu-roulette: + permissions: + issues: write # needed to create new issues + runs-on: ubuntu-22.04 + if: github.repository == 'secureCodeBox/secureCodeBox' + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # 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_DOCU_ROULETTE }} # 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@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/ISSUE_TEMPLATE/documentation_roulette.md From 30c4021545eb314165643a997c9c57fff216e792 Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Thu, 14 Sep 2023 12:39:55 +0200 Subject: [PATCH 2/2] Rename GitHub token Signed-off-by: Heiko Kiesel --- .github/workflows/documentation-roulette.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation-roulette.yaml b/.github/workflows/documentation-roulette.yaml index 08ecacc289..e060d4d54e 100644 --- a/.github/workflows/documentation-roulette.yaml +++ b/.github/workflows/documentation-roulette.yaml @@ -27,7 +27,7 @@ jobs: env: ORG: secureCodeBox TEAM_SLUG: core-team - GH_TOKEN: ${{ secrets.SCB_DOCU_ROULETTE }} # Token used here needs org:read permission + 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