Skip to content

repo sync #2123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 15, 2020
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
47 changes: 26 additions & 21 deletions .github/workflows/triage-unallowed-contributions.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
name: Check unallowed file changes

on:
push:
pull_request:
paths:
- '.github/workflows/**'
- '.github/CODEOWNERS'
- 'translations/**'
- 'assets/fonts/**'
- 'data/graphql/**'
- 'lib/graphql/**'
- 'lib/redirects/**'
- 'lib/rest/**'
- 'lib/webhooks/**'

jobs:
triage:
if: github.repository == 'github/docs' && github.event.pull_request.pull_request.user.login != 'Octomerger'
if: github.repository == 'github/docs' && github.event.pull_request.user.login != 'Octomerger'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Get pull request number
id: pull-number
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const pulls = await github.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: context.sha
})

return pulls.data.map(pull => pull.number).shift()
- name: Check for existing requested changes
id: requested-change
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
Expand All @@ -31,13 +28,19 @@ jobs:
script: |
const pullReviews = await github.pulls.listReviews({
...context.repo,
pull_number: ${{steps.pull-number.outputs.result}}
pull_number: context.payload.number
})

return pullReviews.data
const botReviews = pullReviews.data
.filter(review => review.user.login === 'github-actions[bot]')
.sort((a, b) => new Date(b.submitted_at) - new Date(a.submitted_at))
.shift()

if (botReviews) {
console.log(`Pull request reviews authored by the github-action bot: ${botReviews}`)
}
return botReviews

- name: Get files changed
uses: dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58
id: filter
Expand Down Expand Up @@ -89,29 +92,31 @@ jobs:
if (translationFiles.length > 0) {
await github.issues.addLabels({
...context.repo,
issue_number: ${{steps.pull-number.outputs.result}},
issue_number: context.payload.number,
labels: ['localization']
})
reviewMessage += "\n\nIt looks like you've modified translated content. Unfortunately, we are not able to accept pull requests for translated content. Our translation process involves an integration with an external service at crowdin.com, where all translation activity happens. We hope to eventually open up the translation process to the open source community, but we're not there yet. See https://github.com/github/docs/blob/main/CONTRIBUTING.md#earth_asia-translations for more details."
}

await github.pulls.createReview({
...context.repo,
pull_number: ${{steps.pull-number.outputs.result}},
pull_number: context.payload.number,
body: reviewMessage,
event: 'REQUEST_CHANGES'
})
# When the most recent review was CHANGES_REQUESTED and the existing
# PR no longer contains unallowed changes, dismiss the previous review
- name: Dismiss pull request review
if: ${{ steps.filter.outputs.notAllowed == 'false' && fromJson(steps.requested-change.outputs.result).state == 'CHANGES_REQUESTED' }}
# Check that unallowed files aren't modified and that a
# CHANGES_REQUESTED review already exists
if: ${{ steps.filter.outputs.notAllowed == 'false' && steps.requested-change.outputs.result && fromJson(steps.requested-change.outputs.result).state == 'CHANGES_REQUESTED' }}
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.pulls.dismissReview({
...context.repo,
pull_number: ${{steps.pull-number.outputs.result}},
pull_number: context.payload.number,
review_id: ${{fromJson(steps.requested-change.outputs.result).id}},
message: `✨Looks like you reverted all files we don't accept contributions for. 🙌 A member of the docs team will review your PR soon. 🚂`
})
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ GitHub Desktop keyboard shortcuts on macOS
|<kbd>⌘</kbd><kbd>2</kbd> | Show your commit history
|<kbd>⌘</kbd><kbd>B</kbd> | Show all your branches
|<kbd>⌘</kbd><kbd>G</kbd> | Go to the commit summary field
|<kbd>⌘</kbd><kbd>Enter</kbd> | Commit changes when summary or description field is active
|<kbd>space</kbd>| Select or deselect all highlighted files
|<kbd>⇧</kbd><kbd>⌘</kbd><kbd>N</kbd> | Create a new branch
|<kbd>⇧</kbd><kbd>⌘</kbd><kbd>R</kbd> | Rename the current branch
Expand Down Expand Up @@ -104,6 +105,7 @@ GitHub Desktop keyboard shortcuts on Windows
|<kbd>Ctrl</kbd><kbd>2</kbd> | Show your commit history
|<kbd>Ctrl</kbd><kbd>B</kbd> | Show all your branches
|<kbd>Ctrl</kbd><kbd>G</kbd> | Go to the commit summary field
|<kbd>Ctrl</kbd><kbd>Enter</kbd> | Commit changes when summary or description field is active
|<kbd>space</kbd>| Select or deselect all highlighted files
|<kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>N</kbd> | Create a new branch
|<kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>R</kbd> | Rename the current branch
Expand Down