fix java libraries links #25271
Workflow file for this run
This file contains hidden or 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 | |
if: github.repository == 'github/docs-internal' | |
id: check-diy-docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} | |
run: | | |
echo "Extracting issue numbers from PR description..." | |
# Get issue numbers directly using gh pr view | |
ISSUE_NUMS=$(gh pr view ${{ github.event.pull_request.number }} --json body -q .body | \ | |
grep -oE '(https://github.com/github/docs-content/issues/[0-9]+|github/docs-content#[0-9]+|#[0-9]+)' | \ | |
grep -oE '[0-9]+$' || echo "") | |
echo "Extracted docs-content issue numbers: $ISSUE_NUMS" | |
if [ -n "$ISSUE_NUMS" ]; then | |
for ISSUE_NUM in $ISSUE_NUMS; do | |
echo "Checking issue #$ISSUE_NUM in the docs-content repository..." | |
if gh issue view $ISSUE_NUM --repo github/docs-content --json labels -q '.labels[].name' | grep -q 'DIY docs'; then | |
echo "DIY docs label found for issue #$ISSUE_NUM." | |
echo "DIY_DOCS_LABEL=true" >> $GITHUB_ENV | |
break | |
else | |
echo "Issue #$ISSUE_NUM exists but does not have the DIY docs label." | |
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' }} && github.repository == 'github/docs-internal' | |
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 }} |