-
Notifications
You must be signed in to change notification settings - Fork 60.9k
77 lines (61 loc) · 3.63 KB
/
comment-code-changes.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Code changes comment
# **What it does**: When a PR is opened in docs-internal or docs containing code, it comments with instructions on how to deploy and review the changes.
# **Why we have it**: To help Docs contributors understand how to review their changes.
# **Who does it impact**: docs-internal and docs maintainers and contributors
on:
# Required in lieu of `pull_request` so that the comment can be posted to PRs opened from a fork.
pull_request_target:
types:
- opened
- synchronize
# this applies to any non-content files, this workflow will run for all changed files unless it's ONLY these content-related changes
paths-ignore:
- 'content/**'
- 'data/**'
- 'assets/images/**'
permissions:
contents: read
pull-requests: write
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
postOnCodeChanges:
if: ${{ github.event.pull_request.user.login != 'docs-bot' && (github.repository == 'github/docs-internal' || github.repository == 'github/docs') }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: check out repo content
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Find code changes comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
id: findComment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- CODE_CHANGES_COMMENT -->'
# TODO: We'll update this comment at a later time with permament-ish links to deployment instructions.
- name: Comment on code changes
if: ${{ !steps.findComment.outputs.comment-id }}
run: |
if [[ "${{ github.repository }}" == "github/docs" ]]; then
COMMENT_BODY="<!-- CODE_CHANGES_COMMENT -->
### 👓 How to review these changes
Thank you for your contribution. To review these changes, you can:
1. [Spin up a codespace](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/working-on-github-docs-in-a-codespace)
1. [Set up a local development environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment)
This pull request contains code changes, so we will not generate a table of review links. A Hubber will need to deploy your changes internally to review.
🤖 This comment is automatically generated."
else
COMMENT_BODY="<!-- CODE_CHANGES_COMMENT -->
### 👓 How to review these changes
Thank you for your contribution. To review these changes, you can:
1. [Spin up a codespace](https://github.com/github/docs-team/blob/main/contributing-to-docs/use-a-codespace-to-review.md).
1. [Set up a local development environment](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment#setting-up-your-local-environment).
1. Message \`#docs-engineering\` on Slack for a staging server.
This pull request contains code changes, so we will not generate a table of review links.
🤖 This comment is automatically generated."
fi
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT_BODY"