Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/allowed-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default [
'dawidd6/action-download-artifact@af92a8455a59214b7b932932f2662fdefbd78126', // v2.15.0
'docker://chinthakagodawita/autoupdate-action:v1',
'dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58',
'trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b', // v1.2.4
'github/codeql-action/analyze@v1',
'github/codeql-action/init@v1',
'juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-broken-links-github-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ jobs:
#
# https://docs.github.com/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions

- if: ${{ failure() }}
- if: ${{ failure() && env.FREEZE != 'true' }}
name: Get title for issue
id: check
run: echo "::set-output name=title::$(head -1 broken_github_github_links.md)"
- if: ${{ failure() }}
- if: ${{ failure() && env.FREEZE != 'true'}}
name: Create issue from file
id: github-github-broken-link-report
uses: peter-evans/create-issue-from-file@b4f9ee0a9d4abbfc6986601d9b1a4f8f8e74c77e
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/enterprise-dates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
branch: enterprise-server-dates-update
delete-branch: true

- if: ${{ failure() }}
- if: ${{ failure() && env.FREEZE != 'true' }}
name: Delete remote branch (if previous steps failed)
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911
with:
Expand All @@ -84,7 +84,7 @@ jobs:

- name: Send Slack notification if workflow fails
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
if: failure()
if: ${{ failure() && env.FREEZE != 'true' }}
with:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/remove-unused-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
project: Core docs work for the current week
project-column: Should do
branch: remove-unused-assets
- if: ${{ failure() }}
- if: ${{ failure() && env.FREEZE != 'true' }}
name: Delete remote branch (if previous steps failed)
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ jobs:
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'

- name: Gather files changed
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b
id: get_diff_files
with:
# So that `steps.get_diff_files.outputs.files` becomes
# a string like `foo.js path/bar.md`
output: ' '

- name: Insight into changed files
run: |
echo ${{ steps.get_diff_files.outputs.files }}

- name: Setup node
uses: actions/setup-node@270253e841af726300e85d718a5f606959b2903c
with:
Expand All @@ -67,4 +79,6 @@ jobs:
run: npm run build

- name: Run tests
env:
DIFF_FILES: ${{ steps.get_diff_files.outputs.files }}
run: npm run test tests/${{ matrix.test-group }}/
2 changes: 1 addition & 1 deletion .github/workflows/update-graphql-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
number: ${{ steps.create-pull-request.outputs.pull-request-number }}
- name: Send Slack notification if workflow fails
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
if: failure()
if: ${{ failure() && env.FREEZE != 'true' }}
with:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
Expand Down
57 changes: 57 additions & 0 deletions tests/linting/lint-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,63 @@ function getContent(content) {
return null
}

// Filter out entries from an array like this:
//
// [
// [relativePath, absolutePath],
// ...
// so it's only the files mentioned in the DIFF_FILES environment
// variable, but only if it's set and present.

// Setting an environment varible called `DIFF_FILES` is optional.
// But if and only if it's set, we will respect it.
// And if it set, turn it into a cleaned up Set so it's made available
// every time we use it.
if (process.env.DIFF_FILES) {
// Parse and turn that environment variable string into a set.
// It's faster to do this once and then re-use over and over in the
// .filter() later on.
const only = new Set(
// If the environment variable encodes all the names
// with quotation marks, strip them.
// E.g. Turn `"foo" "bar"` into ['foo', 'bar']
// Note, this assumes no possible file contains a space.
process.env.DIFF_FILES.split(/\s+/g).map((name) => {
if (/^['"]/.test(name) && /['"]$/.test(name)) {
return name.slice(1, -1)
}
return name
})
)
const filterFiles = (tuples) =>
tuples.filter(
([relativePath, absolutePath]) => only.has(relativePath) || only.has(absolutePath)
)
mdToLint = filterFiles(mdToLint)
ymlToLint = filterFiles(ymlToLint)
ghesReleaseNotesToLint = filterFiles(ghesReleaseNotesToLint)
ghaeReleaseNotesToLint = filterFiles(ghaeReleaseNotesToLint)
learningTracksToLint = filterFiles(learningTracksToLint)
featureVersionsToLint = filterFiles(featureVersionsToLint)
}

if (
mdToLint.length +
ymlToLint.length +
ghesReleaseNotesToLint.length +
ghaeReleaseNotesToLint.length +
learningTracksToLint.length +
featureVersionsToLint.length <
1
) {
// With this in place, at least one `test()` is called and you don't
// get the `Your test suite must contain at least one test.` error
// from `jest`.
describe('deliberately do nothing', () => {
test('void', () => {})
})
}

describe('lint markdown content', () => {
if (mdToLint.length < 1) return
describe.each(mdToLint)('%s', (markdownRelPath, markdownAbsPath) => {
Expand Down