Skip to content

Commit 2853a7b

Browse files
authored
Merge pull request #46505 from github/repo-sync
Repo sync
2 parents 9568e96 + af7c2db commit 2853a7b

38 files changed

Lines changed: 986 additions & 118 deletions

File tree

‎.devcontainer/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Update ARG and FROM together from the Node devcontainer image tags:
22
# https://mcr.microsoft.com/en-us/product/devcontainers/javascript-node/tags
33
ARG VARIANT=dev-24-bookworm
4-
FROM mcr.microsoft.com/devcontainers/javascript-node:dev-24-bookworm@sha256:d0445b9546f96869b509aa70b8593bdc0054aca6689bc1dd0324083d0fd2bcc3
4+
FROM mcr.microsoft.com/devcontainers/javascript-node:dev-24-bookworm@sha256:42a1a7629b5a2c22c759a1de4fbb277c9e600b6fecd66b89583fc36e9453e698

‎.github/workflows/check-for-spammy-issues.yml‎

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Check for Spammy Issues
22

3-
# Closes low-value public issues so spam does not stay open in github/docs.
3+
# Closes low-value public issues and issues with emoji titles in github/docs.
4+
# GitHub employees, docs-bot, and the skip-spammy-check label are exempt.
5+
# Add skip-spammy-check before reopening an issue whose title still contains emoji.
46

57
on:
68
issues:
7-
types: [opened]
9+
types: [opened, edited, reopened]
810

911
permissions:
1012
contents: read
@@ -13,58 +15,78 @@ jobs:
1315
spammy-title-check:
1416
name: Remove issues with spammy titles
1517
if: github.repository == 'github/docs'
18+
concurrency:
19+
group: ${{ github.workflow }}-spammy-title-${{ github.event.issue.number }}
20+
cancel-in-progress: false
1621
runs-on: ubuntu-latest
1722
steps:
1823
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
1924
with:
2025
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
2126
script: |
27+
const params = { ...context.repo, issue_number: context.payload.issue.number }
2228
23-
const issue = context.payload.issue
24-
const owner = 'github'
25-
const repo = 'docs'
29+
// Events can predate title edits or an exemption label, so read the current issue.
30+
const { data: issue } = await github.rest.issues.get(params)
31+
if (issue.state !== 'open' || issue.user.login === 'docs-bot') {
32+
return
33+
}
34+
if (issue.labels.some(label => label.name.toLowerCase() === 'skip-spammy-check')) {
35+
core.info('Skipping because the issue has the skip-spammy-check label.')
36+
return
37+
}
2638
2739
const titleWordCount = issue.title.trim().split(' ').length
2840
const titleWordCountMin = 3
2941
const urlRegex = /https?:\/\/\S+/i
3042
const titleHasUrl = urlRegex.test(issue.title)
3143
const titleHasDollarSign = issue.title.includes('$')
44+
// Text-default symbols need an emoji selector; plain digits, #, and * need a keycap.
45+
const titleHasEmoji = /\p{Emoji_Presentation}(?!\uFE0E)|\p{Extended_Pictographic}\uFE0F|[#*0-9]\uFE0F?\u20E3/u.test(issue.title)
46+
// Keep the existing non-emoji heuristics limited to newly opened issues.
47+
const hasOtherSpam = context.payload.action === 'opened' &&
48+
(titleWordCount < titleWordCountMin || titleHasUrl || titleHasDollarSign)
49+
if (!titleHasEmoji && !hasOtherSpam) {
50+
return
51+
}
3252
3353
try {
3454
await github.rest.teams.getMembershipForUserInOrg({
3555
org: 'github',
3656
team_slug: 'employees',
37-
username: context.payload.sender.login,
38-
});
57+
username: issue.user.login,
58+
})
3959
4060
// Skip GitHub employees so legitimate internal reports stay open.
4161
return
4262
} catch (err) {
43-
// The membership lookup throws for non-employees, so fall through to title checks.
44-
if (titleWordCount >= titleWordCountMin && !titleHasUrl && !titleHasDollarSign) {
45-
return
63+
// Only a missing membership means non-employee; other failures must stop moderation.
64+
if (err.status !== 404) {
65+
throw err
4666
}
4767
}
4868
49-
await github.rest.issues.update({
50-
owner: owner,
51-
repo: repo,
52-
issue_number: issue.number,
69+
await github.rest.issues.addLabels({
70+
...params,
5371
labels: ['invalid'],
54-
state: 'closed'
55-
});
72+
})
73+
74+
await github.rest.issues.update({
75+
...params,
76+
state: 'closed',
77+
})
5678
5779
await github.rest.issues.createComment({
58-
owner: owner,
59-
repo: repo,
60-
issue_number: issue.number,
61-
body: `This issue may have been opened accidentally. I'm going to close it now, but feel free to open a new issue with a more descriptive title! Make sure not to include full URLs in your issue titles, and use paths instead.`
62-
});
80+
...params,
81+
body: titleHasEmoji
82+
? 'Closing because the title contains emoji. Please remove the emoji and open a new issue.'
83+
: `This issue may have been opened accidentally. I'm going to close it now, but feel free to open a new issue with a more descriptive title! Make sure not to include full URLs in your issue titles, and use paths instead.`,
84+
})
6385
6486
try {
6587
await github.rest.projects.createCard({
6688
column_id: 11167427,
67-
content_id: context.payload.issue.id,
89+
content_id: issue.id,
6890
content_type: "Issue"
6991
});
7092
} catch (error) {

‎.github/workflows/check-for-spammy-prs.yml‎

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Check for Spammy PRs
22

3-
# Flags low-value public PRs and closes PRs that target branches other than main.
3+
# Flags low-value public PRs and closes PRs with non-main targets or emoji titles.
44
# Maintainers add the skip-spammy-check label to exempt a PR.
55

66
on:
@@ -10,9 +10,57 @@ on:
1010
permissions:
1111
contents: read
1212
issues: read
13-
pull-requests: write
1413

1514
jobs:
15+
emoji-title-check:
16+
name: Close PRs with emoji titles
17+
if: github.repository == 'github/docs'
18+
concurrency:
19+
group: ${{ github.workflow }}-emoji-title-${{ github.event.pull_request.number }}
20+
cancel-in-progress: false
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
24+
with:
25+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
26+
script: |
27+
const item = context.payload.pull_request
28+
const params = { ...context.repo, issue_number: item.number }
29+
30+
// Events can predate title edits or an exemption label, so read the current PR.
31+
const { data: current } = await github.rest.issues.get(params)
32+
if (current.state !== 'open' || current.user.login === 'docs-bot') {
33+
return
34+
}
35+
36+
// Text-default symbols need an emoji selector; plain digits, #, and * need a keycap.
37+
const hasEmoji = /\p{Emoji_Presentation}(?!\uFE0E)|\p{Extended_Pictographic}\uFE0F|[#*0-9]\uFE0F?\u20E3/u.test(current.title)
38+
if (!hasEmoji) {
39+
return
40+
}
41+
42+
if (current.labels.some(label => label.name.toLowerCase() === 'skip-spammy-check')) {
43+
core.info('Skipping because the pull request has the skip-spammy-check label.')
44+
return
45+
}
46+
47+
// Mark automated closures so the skip label can trigger the existing recovery workflow.
48+
await github.rest.issues.addLabels({
49+
...params,
50+
labels: ['invalid'],
51+
})
52+
53+
await github.rest.pulls.update({
54+
...context.repo,
55+
pull_number: item.number,
56+
state: 'closed',
57+
})
58+
59+
await github.rest.issues.createComment({
60+
...params,
61+
body: 'Closing because the title contains emoji. Please remove the emoji and open a new PR.',
62+
})
63+
1664
spammy-pr-check:
1765
name: Label spammy PRs and reject non-main targets
1866
if: >
@@ -50,6 +98,21 @@ jobs:
5098
return changedLines.length > 0 &&
5199
changedLines.every(line => line.slice(1).trim() === '')
52100
})
101+
const onlyBreaksOpeningFrontmatter = files.length > 0 && files.every(file => {
102+
if (
103+
file.status !== 'modified' ||
104+
!file.filename.startsWith('content/') ||
105+
!file.filename.endsWith('.md') ||
106+
file.additions !== 1 ||
107+
file.deletions !== 1
108+
) return false
109+
110+
const lines = (file.patch || '').split('\n')
111+
return /^@@ -1(?:,\d+)? \+1(?:,\d+)? @@/.test(lines[0]) &&
112+
lines[1] === '----' && // Diff prefix "-" followed by the original "---".
113+
lines[2]?.startsWith('+') &&
114+
!/^---(?:\s*yaml)?\s*$/i.test(lines[2].slice(1))
115+
})
53116
const onlyRenames = files.length > 0 && files.every(
54117
f => f.status === 'renamed' && f.additions === 0 && f.deletions === 0
55118
)
@@ -101,6 +164,7 @@ jobs:
101164
isEmptyCommit ||
102165
touchesTooMany ||
103166
isBlankLineEdit ||
167+
onlyBreaksOpeningFrontmatter ||
104168
onlyRenames ||
105169
onlyIndexMd
106170
) {

‎content/account-and-profile/how-tos/contribution-settings/troubleshooting-missing-contributions.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ category:
2323

2424
After making a commit that meets the requirements to count as a contribution, you may need to wait for up to 24 hours to see the contribution appear on your contributions graph. For more information, see [AUTOTITLE](/account-and-profile/how-tos/contribution-settings/viewing-commit-details-from-your-timeline).
2525

26+
## Contribution counts are stale after rewriting history
27+
28+
If you own an account and squash commits or force-push rewritten history, your profile may continue to count commits that are no longer in the repository's visible history. This can include contributions to private repositories. This is a stale-count issue, not a missing-contribution issue, so the other troubleshooting steps in this article do not apply.
29+
30+
{% ifversion ghes %}
31+
If you use {% data variables.product.prodname_ghe_server %}, ask your site administrator to rebuild your contribution data. For more information, see [AUTOTITLE](/admin/managing-accounts-and-repositories/managing-users-in-your-enterprise/rebuilding-contributions-data).
32+
{% else %}
33+
If the counts remain incorrect, {% data variables.contact.github_support %} may be able to rebuild your contribution data, depending on the support options available to your account. For more information, see [AUTOTITLE](/support/learning-about-github-support/about-github-support).
34+
{% endif %}
35+
36+
After a rebuild, allow up to 24 hours for your profile's contributions graph and activity summary to refresh. Then:
37+
38+
1. Recheck the affected dates.
39+
1. If the counts are still incorrect, {% ifversion ghes %}contact your site administrator{% else %}follow up through the support options available to your account{% endif %}.
40+
2641
## Your local Git commit email isn't connected to your account
2742

2843
Commits must be made with an email address that is connected to your account on {% data variables.product.prodname_dotcom %}{% ifversion fpt or ghec %}, or the {% data variables.product.prodname_dotcom %}-provided `noreply` email address provided to you in your email settings,{% endif %} in order to appear on your contributions graph.{% ifversion fpt or ghec %} For more information about `noreply` email addresses, see [AUTOTITLE](/account-and-profile/reference/email-addresses-reference#your-noreply-email-address).{% endif %}

‎content/admin/troubleshooting-your-instance/index.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ intro: 'Diagnose and resolve common problems with {% data variables.location.pro
44
versions:
55
ghes: '*'
66
children:
7+
- /troubleshooting-instance-configuration
8+
- /troubleshooting-tls-and-certificates
79
- /troubleshooting-upgrades-and-migrations
810
- /troubleshooting-storage-and-disks
911
- /troubleshooting-github-actions-data-and-database-health

0 commit comments

Comments
 (0)