Skip to content

Commit

Permalink
fixup! tools: add workflow to ensure README lists are in sync with …
Browse files Browse the repository at this point in the history
…gh teams
  • Loading branch information
aduh95 committed Jul 17, 2024
1 parent 315a03d commit e50561e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/linters-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
name: Linters (README.md)

on:
pull_request:
# We need `pull_request_target` to access the secrets
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
paths: [README.md]
push:
Expand All @@ -30,20 +31,24 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Get ${{ env.TEAM }} team members
ref: ${{ github.event.repository.default_branch }}
- name: Get team members
id: team_members
run: |
get_list_members() {
TEAM="$1"
QUOTE='"'
gh api "/orgs/nodejs/teams/$TEAM/members" -X GET -f per_page=100 --jq "map(.login) | @sh ${QUOTE}${TEAM}=\(tojson)${QUOTE}"
gh api "/orgs/nodejs/teams/$TEAM/members" -X GET -f per_page=100 --jq "map(.login) | ${QUOTE}${TEAM}=\(tojson)${QUOTE}"
}
get_list_members "collaborators" >> "$GITHUB_OUTPUT"
get_list_members "issue-triage" >> "$GITHUB_OUTPUT"
get_list_members "tsc" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
- name: Get modified README
if: github.event_name != 'push'
run: curl -fsSLo README.md "https://raw.githubusercontent.com/nodejs/node/$GITHUB_SHA/README.md"
- run: tools/lint-readme-lists.mjs "$TEAMS"
env:
TEAMS: ${{ tojson(steps.team_members.outputs) }}
7 changes: 0 additions & 7 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,3 @@ jobs:
persist-credentials: false
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
lint-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- run: tools/lint-readme-lists.mjs

0 comments on commit e50561e

Please sign in to comment.