Bump next from 15.1.5 to 15.2.3 in the npm_and_yarn group #25253
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
name: Ready for docs-content review | |
# **What it does**: Adds pull requests in the docs-internal repository to the docs-content review board when the "ready-for-doc-review" label is added or when a review by docs-content or docs-reviewers is requested. Adds the "DIY docs" label to the PR if it is connected to a DIY docs issue in the docs-content repo. This workflow is also called as a reusable workflow from other repos including docs-content, docs-strategy, docs-early-access, and github. | |
# **Why we have it**: So that other GitHub teams can easily request reviews from the docs-content team, and so that writers can see when a PR is ready for review | |
# **Who does it impact**: Writers who need to review docs-related PRs | |
on: | |
pull_request: | |
types: [labeled, review_requested] | |
workflow_call: | |
permissions: | |
contents: read | |
jobs: | |
request_doc_review: | |
name: Request a review from the docs-content team | |
if: >- | |
github.repository_owner == 'github' && github.repository != 'github/docs' && | |
(github.event.label.name == 'ready-for-doc-review' || github.event.requested_team.name == 'docs-content' || github.event.requested_team.name == 'docs-reviewers') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo content | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
repository: github/docs-internal | |
token: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} | |
- name: Setup Node.js | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version-file: 'package.json' | |
cache: npm | |
- name: Install dependencies | |
run: npm install @octokit/graphql | |
- name: Set AUTHOR_LOGIN | |
run: | | |
if [[ "${{ github.event.pull_request.assignee.login && github.event.pull_request.user.login == 'docs-bot' }}" ]]; then | |
echo "AUTHOR_LOGIN=${{ github.event.pull_request.assignee.login }}" >> $GITHUB_ENV | |
else | |
echo "AUTHOR_LOGIN=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV | |
fi | |
# Check if the PR is connected to an issue that has the DIY docs label. The grep command parses through the PR description to find issue numbers that are linked in the PR description. The GitHub CLI command then checks if the issue exists in the docs-content repo, then checks if the linked docs-content issues have the DIY docs label. If the linked issues have the DIY docs label, the DIY_DOCS_LABEL environment variable is set to true. | |
- name: Check if PR is connected to DIY docs issue | |
id: check-diy-docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} | |
run: | | |
echo "Extracting issue numbers from PR description..." | |
# Clean up PR description to avoid syntax errors in grep command | |
PR_BODY="${{ github.event.pull_request.body }}" | |
echo "PR description to use in the script: $PR_BODY" | |
ISSUE_NUMS=$(echo "$PR_BODY" | grep -oE '(https://github.com/github/docs-content/issues/[0-9]+|github/docs-content#[0-9]+|#[0-9]+)' | grep -oE '[0-9]+$') | |
echo "Extracted issue numbers: $ISSUE_NUMS" | |
if [ -n "$ISSUE_NUMS" ]; then | |
for ISSUE_NUM in $ISSUE_NUMS; do | |
# Check if the issue exists in the docs-content repository | |
echo "Checking issue $ISSUE_NUM in the docs-content repository..." | |
if gh issue view $ISSUE_NUM --repo github/docs-content --json labels > /dev/null 2>&1; then | |
echo "Issue $ISSUE_NUM exists in docs-content. Fetching labels..." | |
# Fetch labels for the issue | |
LABELS=$(gh issue view $ISSUE_NUM --repo github/docs-content --json labels --jq '.labels[].name' || echo "") | |
echo "Labels for issue $ISSUE_NUM: $LABELS" | |
if echo "$LABELS" | grep -q 'DIY docs'; then | |
echo "DIY docs label found for issue $ISSUE_NUM." | |
echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV | |
break | |
else | |
echo "DIY docs label not found for issue $ISSUE_NUM." | |
fi | |
else | |
echo "Issue $ISSUE_NUM does not exist in the docs-content repository." | |
fi | |
done | |
else | |
echo "No DIY docs issues found in the PR description." | |
fi | |
# If the PR description contains a link to a DIY docs issue, add the DIY docs label to the PR. | |
- name: Add the DIY docs label if connected to a DIY docs issue | |
if: ${{ env.DIY_DOCS_LABEL == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
run: | | |
gh pr edit $PR_URL --add-label 'DIY docs' | |
- name: Run script | |
run: | | |
npm run ready-for-docs-review | |
env: | |
TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} | |
PROJECT_NUMBER: 2936 | |
ORGANIZATION: 'github' | |
ITEM_NODE_ID: ${{ github.event.pull_request.node_id }} | |
REPO: ${{ github.event.pull_request.base.repo.full_name }} |