Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
67 lines
2.7 KiB
YAML
67 lines
2.7 KiB
YAML
name: Changelog prompt when a PR is closed
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
comment-on-pr:
|
|
# This workflow should only run on the 'github/docs-internal' repository because it posts changelog instructions
|
|
# and links that are specific to the internal documentation process and resources.
|
|
# It also only runs if PR is merged into the main branch.
|
|
if: github.repository == 'github/docs-internal' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check if PR author is in docs-content team
|
|
id: check_team
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
|
script: |
|
|
try {
|
|
const pr = context.payload.pull_request;
|
|
await github.rest.teams.getMembershipForUserInOrg({
|
|
org: 'github',
|
|
team_slug: 'docs-content',
|
|
username: pr.user.login,
|
|
});
|
|
core.exportVariable('CONTINUE_WORKFLOW', 'true');
|
|
} catch(err) {
|
|
core.info("Workflow triggered by a merged PR, but the PR author is not a member of the docs-content team.");
|
|
core.exportVariable('CONTINUE_WORKFLOW', 'false');
|
|
}
|
|
|
|
- name: Post changelog instructions comment
|
|
|
|
if: env.CONTINUE_WORKFLOW == 'true'
|
|
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
|
script: |
|
|
// Get PR author username
|
|
const pr = context.payload.pull_request;
|
|
const prAuthor = pr.user.login;
|
|
|
|
// Compose the comment body with readable YAML and correct formatting
|
|
const commentBody =
|
|
"👋 @" + prAuthor +
|
|
" - Did this PR add noteworthy changes to the GitHub docs? If so, you might want to publicize this by adding an entry to " +
|
|
"the [Docs changelog](https://github.com/github/docs-internal/blob/main/CHANGELOG.md).\n\n" +
|
|
"To do this, type `/changelog` in a new comment on this PR and complete the fields.\n\n" +
|
|
"A message will be posted to the **#docs-changelog** channel and a PR will be raised to update the [CHANGELOG.md](https://github.com/github/docs-internal/blob/main/CHANGELOG.md) file.";
|
|
|
|
// Post the comment
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
body: commentBody
|
|
});
|