This commit is contained in:
Octomerger Bot 2020-12-16 04:09:17 +10:00 коммит произвёл GitHub
Родитель ce7f9e87db a8bfd0a324
Коммит fcc843ef2d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 28 добавлений и 21 удалений

Просмотреть файл

@ -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
@ -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
@ -89,7 +92,7 @@ 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."
@ -97,21 +100,23 @@ jobs:
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. 🚂`
})

Просмотреть файл

@ -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
@ -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