fixup! tools: add workflow to ensure README
lists are in sync with …
#3
This file contains 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
# We need a separate workflow file so failures on the README are not reported on | |
# all PRs, only on the ones that update the README. | |
name: Linters (README.md) | |
on: | |
# We need `pull_request_target` to access the secrets | |
pull_request_target: | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths: [README.md] | |
push: | |
branches: | |
- main | |
- v[0-9]+.x-staging | |
- v[0-9]+.x | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION: '3.12' | |
NODE_VERSION: lts/* | |
permissions: | |
contents: read | |
jobs: | |
lint-readme-lists: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
persist-credentials: false | |
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}" | |
} | |
get_list_members "collaborators" >> "$GITHUB_OUTPUT" | |
get_list_members "issue-triage" >> "$GITHUB_OUTPUT" | |
get_list_members "tsc" >> "$GITHUB_OUTPUT" | |
env: | |
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) }} |