Skip to content

Commit 7a96959

Browse files
authored
repo sync
2 parents 22d2ea8 + 15c1cf8 commit 7a96959

26 files changed

Lines changed: 287 additions & 144 deletions

File tree

.github/workflows/js-lint.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,8 @@ on:
1010
- translations
1111

1212
jobs:
13-
see_if_should_skip:
14-
runs-on: ubuntu-latest
15-
16-
outputs:
17-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
18-
steps:
19-
- id: skip_check
20-
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
21-
with:
22-
cancel_others: 'false'
23-
github_token: ${{ github.token }}
24-
paths: '["**/*.js", "package*.json", ".github/workflows/js-lint.yml", ".eslint*"]'
25-
2613
lint:
2714
runs-on: ubuntu-latest
28-
needs: see_if_should_skip
29-
if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
3015
steps:
3116
- name: Check out repo
3217
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f

.github/workflows/repo-sync-stalls.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
2323
script: |
2424
let pulls;
25-
const owner = context.payload.repository.owner.login
26-
const repo = context.payload.repository.name
25+
const owner = context.repo.owner
26+
const repo = context.repo.repo
2727
try {
2828
pulls = await github.pulls.list({
2929
owner: owner,

.github/workflows/repo-sync.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
name: Repo Sync
88

99
on:
10+
workflow_dispatch:
1011
schedule:
1112
- cron: '*/15 * * * *' # every 15 minutes
1213

.github/workflows/yml-lint.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,8 @@ on:
1010
- translations
1111

1212
jobs:
13-
see_if_should_skip:
14-
runs-on: ubuntu-latest
15-
16-
outputs:
17-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
18-
steps:
19-
- id: skip_check
20-
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
21-
with:
22-
cancel_others: 'false'
23-
github_token: ${{ github.token }}
24-
paths: '["**/*.yml", "**/*.yaml", "package*.json", ".github/workflows/yml-lint.yml"]'
25-
2613
lint:
2714
runs-on: ubuntu-latest
28-
needs: see_if_should_skip
29-
if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
3015
steps:
3116
- name: Check out repo
3217
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
23.1 KB
Loading

content/discussions/quickstart.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ Repository owners and people with write access can enable {% data variables.prod
2121
When you first enable a {% data variables.product.prodname_discussions %}, you will be invited to configure a welcome post.
2222

2323
{% data reusables.repositories.navigate-to-repo %}
24-
{% data reusables.repositories.sidebar-settings %}
24+
1. Under your repository name, click {% octicon "gear" aria-label="The gear icon" %}
25+
**Settings**.
26+
![Public settings button](/assets/images/help/discussions/public-repo-settings.png)
2527
1. Under "Features", click **Set up discussions**.
2628
![Set up a discussion button under "Features" for enabling or disabling discussions for a repository](/assets/images/help/discussions/setup-discussions-button.png)
2729
1. Under "Start a new discussion," edit the template to align with the resources and tone you want to set for your community.

content/github/working-with-github-support/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Working with GitHub Support
33
redirect_from:
44
- /categories/working-with-github-support
5+
- /forum
56
versions:
67
free-pro-team: '*'
78
---

content/rest/overview/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ curl -H 'Authorization: token my-oauth-token' https://api.github.com/user/repos
6363

6464
#### Calls to OAuth Authorizations API
6565

66-
If you're making [OAuth Authorization API](/enterprise-server@2.22/rest/reference/oauth-authorizations) calls to manage your OAuth app's authorizations or to generate access tokens, similar to this example:
66+
If you're making [OAuth Authorization API](/enterprise-server/rest/reference/oauth-authorizations) calls to manage your OAuth app's authorizations or to generate access tokens, similar to this example:
6767

6868
```bash
6969
curl -u my_username:my_password -X POST "https://api.github.com/authorizations" -d '{"scopes":["public_repo"], "note":"my token", "client_id":"my_client_id", "client_secret":"my_client_secret"}'
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
You can enable or disable discussions for a repository.
22

33
{% data reusables.repositories.navigate-to-repo %}
4-
{% data reusables.repositories.sidebar-settings %}
4+
1. Under your repository name, click {% octicon "gear" aria-label="The gear icon" %}
5+
**Settings**.
6+
![Repository settings button](/assets/images/help/discussions/public-repo-settings.png)
57
1. Under "Features", select **Discussions**.
68
![Checkbox under "Features" for enabling or disabling discussions for a repository](/assets/images/help/discussions/select-discussions-checkbox.png)

lib/data-directory.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const assert = require('assert')
2+
const fs = require('fs').promises
3+
const path = require('path')
4+
const walk = require('walk-sync')
5+
const yaml = require('js-yaml')
6+
const { isRegExp, set } = require('lodash')
7+
const filenameToKey = require('./filename-to-key')
8+
9+
module.exports = async function dataDirectory (dir, opts = {}) {
10+
const defaultOpts = {
11+
preprocess: (content) => { return content },
12+
ignorePatterns: [/README\.md$/i],
13+
extensions: [
14+
'.json',
15+
'.md',
16+
'.markdown',
17+
'.yaml',
18+
'.yml'
19+
]
20+
}
21+
22+
opts = Object.assign({}, defaultOpts, opts)
23+
24+
// validate input
25+
assert(Array.isArray(opts.ignorePatterns))
26+
assert(opts.ignorePatterns.every(isRegExp))
27+
assert(Array.isArray(opts.extensions))
28+
assert(opts.extensions.length)
29+
30+
// start with an empty data object
31+
const data = {}
32+
33+
// find YAML and Markdown files in the given directory, recursively
34+
await Promise.all(walk(dir, { includeBasePath: true })
35+
.filter(filename => {
36+
// ignore files that match any of ignorePatterns regexes
37+
if (opts.ignorePatterns.some(pattern => pattern.test(filename))) return false
38+
39+
// ignore files that don't have a whitelisted file extension
40+
return opts.extensions.includes(path.extname(filename).toLowerCase())
41+
})
42+
.map(async filename => {
43+
// derive `foo.bar.baz` object key from `foo/bar/baz.yml` filename
44+
const key = filenameToKey(path.relative(dir, filename))
45+
const extension = path.extname(filename).toLowerCase()
46+
47+
let fileContent = await fs.readFile(filename, 'utf8')
48+
49+
if (opts.preprocess) fileContent = opts.preprocess(fileContent)
50+
51+
// add this file's data to the global data object
52+
switch (extension) {
53+
case '.json':
54+
set(data, key, JSON.parse(fileContent))
55+
break
56+
case '.yaml':
57+
case '.yml':
58+
set(data, key, yaml.safeLoad(fileContent, { filename }))
59+
break
60+
case '.md':
61+
case '.markdown':
62+
set(data, key, fileContent)
63+
break
64+
}
65+
}))
66+
67+
return data
68+
}

0 commit comments

Comments
 (0)