Merge branch 'main' of github.com:github/docs-internal into parallelize-link-check-workflows
This commit is contained in:
2
.github/allowed-actions.js
vendored
2
.github/allowed-actions.js
vendored
@@ -12,7 +12,7 @@ module.exports = [
|
||||
'actions/setup-ruby@5f29a1cd8dfebf420691c4c9a0e832e2fae5a526', //actions/setup-ruby@v1.1.2
|
||||
'actions/stale@af4072615903a8b031f986d25b1ae3bf45ec44d4', //actions/stale@v3.0.13
|
||||
'crowdin/github-action@fd9429dd63d6c0f8a8cb4b93ad8076990bd6e688',
|
||||
'crykn/copy_folder_to_another_repo_action@abc264e1c16eb3d7b1f7763bfdb0e1699ad43120',
|
||||
'crykn/copy_folder_to_another_repo_action@0282e8b9fef06de92ddcae9fe6cb44df6226646c',
|
||||
'cschleiden/actions-linter@43fd4e08e52ed40c0e2782dc2425694388851576',
|
||||
'dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911',
|
||||
'docker://chinthakagodawita/autoupdate-action:v1',
|
||||
|
||||
62
.github/workflows/check-for-spammy-issues.yml
vendored
Normal file
62
.github/workflows/check-for-spammy-issues.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Check for Spammy Issues
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
jobs:
|
||||
spammy-title-check:
|
||||
name: Remove issues with spammy titles
|
||||
if: github.repository == 'github/docs'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
|
||||
script: |
|
||||
|
||||
const issue = context.payload.issue
|
||||
const owner = 'github'
|
||||
const repo = 'docs'
|
||||
|
||||
const titleWordCount = issue.title.trim().split(' ').length
|
||||
const titleWordCountMin = 2
|
||||
|
||||
try {
|
||||
await github.teams.getMembershipForUserInOrg({
|
||||
org: 'github',
|
||||
team_slug: 'employees',
|
||||
username: context.payload.sender.login,
|
||||
});
|
||||
|
||||
// Do not perform this workflow with GitHub employees. This return
|
||||
// statement only gets hit if the user is a GitHub employee
|
||||
return
|
||||
} catch(err) {
|
||||
// An error will be thrown if the user is not a GitHub employee
|
||||
// If a user is not a GitHub employee, we should check to see if title has at least the minimum required number of words in it and if it does, we can exit the workflow
|
||||
|
||||
if(titleWordCount > titleWordCountMin) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Assuming the user is not a GitHub employee and the issue title
|
||||
// has the minimum number of words required, proceed.
|
||||
//
|
||||
|
||||
// Close the issue and add the invalid label
|
||||
await github.issues.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: issue.number,
|
||||
labels: ['invalid'],
|
||||
state: 'closed'
|
||||
});
|
||||
|
||||
// Comment on the issue
|
||||
await github.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: issue.number,
|
||||
body: "This issue appears to have been opened accidentally. I'm going to close it now, but feel free to open a new issue or ask any questions in [discussions](https://github.com/github/docs/discussions)!"
|
||||
});
|
||||
5
.github/workflows/site-policy-sync.yml
vendored
5
.github/workflows/site-policy-sync.yml
vendored
@@ -29,13 +29,14 @@ jobs:
|
||||
|
||||
# Pushes to other repo
|
||||
- name: Push folder to another repository
|
||||
uses: crykn/copy_folder_to_another_repo_action@abc264e1c16eb3d7b1f7763bfdb0e1699ad43120
|
||||
uses: crykn/copy_folder_to_another_repo_action@0282e8b9fef06de92ddcae9fe6cb44df6226646c
|
||||
env:
|
||||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_SITEPOLICY }}
|
||||
with:
|
||||
source_folder: 'content/github/site-policy'
|
||||
destination_repo: 'github/site-policy'
|
||||
destination_branch: 'repo-sync'
|
||||
destination_branch: 'main'
|
||||
destination_branch_create: 'repo-sync'
|
||||
destination_folder: 'Policies'
|
||||
user_email: 'pcihon@users.noreply.github.com'
|
||||
user_name: 'pcihon'
|
||||
|
||||
Reference in New Issue
Block a user