Skip to content

Commit 5a95792

Browse files
authored
Add rule to find hardcoded docs urls (#42212)
1 parent 31d83ed commit 5a95792

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

content/apps/creating-github-apps/writing-code-for-a-github-app/building-ci-checks-with-a-github-app.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ class GHAapp < Sinatra::Application
319319
# this request is an attack, and you should reject it. GitHub uses the HMAC
320320
# hexdigest to compute the signature. The `X-HUB-Signature` looks something
321321
# like this: 'sha1=123456'.
322-
# See https://developer.github.com/webhooks/securing/ for details.
323322
def verify_webhook_signature
324323
their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='
325324
method, their_digest = their_signature_header.split('=')
@@ -571,7 +570,7 @@ You can test that the server is listening to your app by triggering an event for
571570

572571
1. Create a new repository to use for testing your tutorial code. For more information, see "[AUTOTITLE](/repositories/creating-and-managing-repositories/creating-a-new-repository)."
573572
1. Install the {% data variables.product.prodname_github_app %} on the repository you just created. For more information, see "[AUTOTITLE](/apps/using-github-apps/installing-your-own-github-app#installing-your-own-github-app)." During the installation process, choose **Only select repositories**, and select the repository you created in the previous step.
574-
2. After you click **Install**, look at the output in the terminal tab where you're running `server.rb`. You should see something like this:
573+
1. After you click **Install**, look at the output in the terminal tab where you're running `server.rb`. You should see something like this:
575574

576575
```shell
577576
> D, [2023-06-08T15:45:43.773077 #30488] DEBUG -- : ---- received event installation
@@ -1147,7 +1146,7 @@ To push to a repository, your app must have write permissions for "Contents" in
11471146
To commit files, Git must know which username and email address to associate with the commit. Next you'll add environment variables to store the name and email address that your app will use when it makes Git commits.
11481147
11491148
1. Open the `.env` file you created earlier in this tutorial.
1150-
2. Add the following environment variables to your `.env` file. Replace `APP_NAME` with the name of your app, and `EMAIL_ADDRESS` with any email you'd like to use for this example.
1149+
1. Add the following environment variables to your `.env` file. Replace `APP_NAME` with the name of your app, and `EMAIL_ADDRESS` with any email you'd like to use for this example.
11511150
11521151
```shell copy
11531152
GITHUB_APP_USER_NAME="APP_NAME"
@@ -1542,7 +1541,6 @@ class GHAapp < Sinatra::Application
15421541
# this request is an attack, and you should reject it. GitHub uses the HMAC
15431542
# hexdigest to compute the signature. The `X-HUB-Signature` looks something
15441543
# like this: 'sha1=123456'.
1545-
# See https://developer.github.com/webhooks/securing/ for details.
15461544
def verify_webhook_signature
15471545
their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='
15481546
method, their_digest = their_signature_header.split('=')

src/content-linter/style/github-docs.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export const githubDocsConfig = {
3434
severity: 'error',
3535
'partial-markdown-files': true,
3636
},
37+
'no-github-docs-domains': {
38+
// GHD020
39+
severity: 'error',
40+
'partial-markdown-files': true,
41+
},
3742
'search-replace': {
3843
severity: 'error',
3944
'severity-local-env': 'warning',
@@ -45,6 +50,34 @@ export const githubDocsConfig = {
4550
search: 'TODOCS',
4651
searchScope: 'all',
4752
},
53+
{
54+
name: 'docs-domain',
55+
message: 'Catch occurrences of docs.gitub.com domain.',
56+
search: 'docs.gitub.com',
57+
searchScope: 'all',
58+
},
59+
{
60+
name: 'help-domain',
61+
message: 'Catch occurrences of help.github.com domain.',
62+
search: 'help.github.com',
63+
searchScope: 'all',
64+
},
65+
{
66+
name: 'preview-domain',
67+
message: 'Catch occurrences of preview.ghdocs.com domain.',
68+
search: 'preview.ghdocs.com',
69+
searchScope: 'all',
70+
},
71+
{
72+
name: 'developer-domain',
73+
message: 'Catch occurrences of developer.github.com domain.',
74+
// Do not match developer.github.com/changes or
75+
// developer.github.com/enterprise/[0-9] or
76+
// developer.github.com/enterprise/{{something}} (e.g. liquid).
77+
// There are occurences that will likely always remain in the content.
78+
searchPattern: '/developer.github.com(?!/(changes|enterprise/([0-9]|{))).*/g',
79+
searchScope: 'all',
80+
},
4881
],
4982
},
5083
}

0 commit comments

Comments
 (0)