Skip to content

[ig/me] Media & Entertainment Interest Group Charter #130

[ig/me] Media & Entertainment Interest Group Charter

[ig/me] Media & Entertainment Interest Group Charter #130

name: Create review request issues for charters
on:
issues:
types: [labeled]
# Using
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#example-using-an-output-to-define-two-matrices
jobs:
retrieve-horizontal-repos: # define the matrix of horizontal repo names
runs-on: ubuntu-latest
outputs:
repos: ${{ steps.extract.outputs.repos }}
steps:
# Abort on http get failure
# jq comes pre-installed in Github runners: https://jqlang.org/
# -c to disable JSON pretty printing
# filter out null values and make values unique
- name: Retrieve common-labels.json
id: extract
run: |
# the list of horizontal repositories is hidden inside the definition of the horizontal labels
curl --fail -o labels.json "https://w3c.github.io/common-labels.json"
# AB is per https://github.com/w3c/strategy/issues/421
ADDONS=',"w3c/AB-memberonly"'
REPOS=$(jq -c -r '[.[]."repo-request"] | map(select(.!=null)) | unique' labels.json | sed -s 's|\]|'"$ADDONS"']|')
echo "repos=$REPOS" >> "$GITHUB_OUTPUT"
create-issue:
if: github.event.label.name == 'Horizontal review requested'
runs-on: ubuntu-latest
permissions:
issues: write
needs: retrieve-horizontal-repos
strategy:
matrix:
repo: ${{ fromJSON(needs.retrieve-horizontal-repos.outputs.repos) }}
steps:
- name: Create issue payload file
env:
ISSUE_CONTEXT: ${{ toJSON(github.event.issue) }}
run: echo "$ISSUE_CONTEXT" > issue.json
- name: create issue in ${{ matrix.repo }}
env:
repo: ${{ matrix.repo }}
GITHUB_TOKEN: ${{ secrets.W3CBOT_TOKEN }}
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
ASSIGNEES=$(jq -c -r '.assignees.[].login' issue.json | sed -s 's/^/cc @/')
cat << EOF > body.txt
This issue was created because the 'horizontal review requested' label was added to
§ ${{ github.event.issue.html_url }}
This review is requested prior to the [Advisory Committee Review](https://www.w3.org/guide/process/charter.html#ac-review).
EOF
echo "$ISSUE_BODY" >> body.txt
cat << EOF >> body.txt
## Charter facilitator(s)
$ASSIGNEES
EOF
gh issue create \
--repo "$repo" \
--title "${{ github.event.issue.title }}" \
--body-file body.txt \
--label "charter"