Skip to content

Commit 85f0d89

Browse files
authored
Merge pull request #27365 from github/repo-sync
Repo sync
2 parents 9e09673 + 69f60ee commit 85f0d89

File tree

9 files changed

+91
-16
lines changed

9 files changed

+91
-16
lines changed

.github/actions-scripts/purge-old-workflow-runs.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import fs from 'fs'
2525
import assert from 'node:assert/strict'
2626

2727
import { getOctokit } from '@actions/github'
28+
import { RequestError } from '@octokit/request-error'
2829

2930
main()
3031
async function main() {
@@ -51,10 +52,12 @@ async function main() {
5152
repo,
5253
})
5354

55+
const validWorkflows = allWorkflows.filter((w) => !w.path.startsWith('dynamic/'))
56+
5457
const sortByDate = (a, b) => a.updated_at.localeCompare(b.updated_at)
5558
const workflows = [
56-
...allWorkflows.filter((w) => !fs.existsSync(w.path)).sort(sortByDate),
57-
...allWorkflows.filter((w) => fs.existsSync(w.path)).sort(sortByDate),
59+
...validWorkflows.filter((w) => !fs.existsSync(w.path)).sort(sortByDate),
60+
...validWorkflows.filter((w) => fs.existsSync(w.path)).sort(sortByDate),
5861
]
5962

6063
let deletions = 0
@@ -65,11 +68,25 @@ async function main() {
6568
? `${workflow.path} still exists on disk`
6669
: `${workflow.path} no longer exists on disk`,
6770
)
68-
deletions += await deleteWorkflowRuns(github, owner, repo, workflow, {
69-
dryRun: DRY_RUN,
70-
minAgeDays: MIN_AGE_DAYS,
71-
maxDeletions: MAX_DELETIONS - deletions,
72-
})
71+
try {
72+
deletions += await deleteWorkflowRuns(github, owner, repo, workflow, {
73+
dryRun: DRY_RUN,
74+
minAgeDays: MIN_AGE_DAYS,
75+
maxDeletions: MAX_DELETIONS - deletions,
76+
})
77+
} catch (error) {
78+
// Generally, if it fails, it's because of a network error or
79+
// because busy servers. It's not our fault, but considering that
80+
// this script is supposed to run on frequent schedule, we don't
81+
// need to fret. We'll just try again next time.
82+
if (error instanceof RequestError && error.status >= 500) {
83+
console.log(`RequestError: ${error.message}`)
84+
console.log(` status: ${error.status}`)
85+
break
86+
} else {
87+
throw error
88+
}
89+
}
7390

7491
if (deletions >= MAX_DELETIONS) {
7592
console.log(`Reached max number of deletions: ${MAX_DELETIONS}`)

content/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ For example, the following form definition includes four form elements: a text a
3939
multiple: false
4040
options:
4141
- 1.0.2 (Default)
42-
- 1.0.3 (Edge)
42+
- 1.0.3 (Edge){% ifversion issue-form-dropdown-defaults %}
43+
default: 0{% endif %}
4344
validations:
4445
required: true
4546
- type: checkboxes
@@ -203,6 +204,7 @@ You can use a `dropdown` element to add a dropdown menu in your form.
203204
| `description` | A description of the dropdown to provide extra context or guidance, which is displayed in the form. | {% octicon "x" aria-label="Optional" %} | String | Empty String | {% octicon "dash" aria-label="Not applicable" %} |
204205
| `multiple` | Determines if the user can select more than one option. | {% octicon "x" aria-label="Optional" %} | Boolean | false | {% octicon "dash" aria-label="Not applicable" %} |
205206
| `options` | An array of options the user can choose from. Cannot be empty and all choices must be distinct. | {% octicon "check" aria-label="Required" %} | String array | {% octicon "dash" aria-label="Not applicable" %} | {% octicon "dash" aria-label="Not applicable" %} |
207+
| `default` | Index of the preselected option in the `options` array. When a default option is specified, you cannot include "None" or "n/a" as options. | {% octicon "x" aria-label="Optional" %} | Integer | {% octicon "dash" aria-label="Not applicable" %} | {% octicon "dash" aria-label="Not applicable" %} |
206208

207209
#### Validations for `dropdown`
208210

@@ -221,10 +223,11 @@ body:
221223
attributes:
222224
label: How did you download the software?
223225
options:
226+
- Built from source
224227
- Homebrew
225228
- MacPorts
226-
- apt-get
227-
- Built from source
229+
- apt-get{% ifversion issue-form-dropdown-defaults %}
230+
default: 0{% endif %}
228231
validations:
229232
required: true
230233
```

content/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ You can set the following top-level keys for each issue form.
4646
| `body` | Definition of the input types in the form. | Required | Array |
4747
| `assignees` | People who will be automatically assigned to issues created with this template. | Optional | Array or comma-delimited string |
4848
| `labels` | Labels that will automatically be added to issues created with this template. If a label does not already exist in the repository, it will not be automatically added to the issue. | Optional | Array or comma-delimited string |
49-
| `title` | A default title that will be pre-populated in the issue submission form. | Optional | String |
49+
| `title` | A default title that will be pre-populated in the issue submission form. | Optional | String |{% ifversion projects-in-issue-forms %}
50+
| `projects` | Projects that any issues created with this template will automatically be added to. | Optional | Array or comma-delimited string |{% endif %}
51+
5052

5153
For the available `body` input types and their syntaxes, see "[AUTOTITLE](/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema)."
5254

content/issues/tracking-your-work-with-issues/creating-an-issue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Query parameter | Example
165165
`labels` | `https://github.com/octo-org/octo-repo/issues/new?labels=help+wanted,bug` creates an issue with the labels "help wanted" and "bug".
166166
`milestone` | `https://github.com/octo-org/octo-repo/issues/new?milestone=testing+milestones` creates an issue with the milestone "testing milestones."
167167
`assignees` | `https://github.com/octo-org/octo-repo/issues/new?assignees=octocat` creates an issue and assigns it to @octocat.
168-
`projects` | `https://github.com/octo-org/octo-repo/issues/new?title=Bug+fix&projects=octo-org/1` creates an issue with the title "Bug fix" and adds it to the organization's project board 1.
168+
`projects` | `https://github.com/octo-org/octo-repo/issues/new?title=Bug+fix&projects=octo-org/1` creates an issue with the title "Bug fix" and adds it to the organization's project board 1. {% ifversion projects-v2 and projects-v1 %}{% ifversion projects-in-issue-forms %}{% else %}Only {% data variables.projects.projects_v1_boards %} can currently be specified in URL queries.{% endif %}{% endif %}
169169
`template` | `https://github.com/octo-org/octo-repo/issues/new?template=issue_template.md` creates an issue with a template in the issue body. The `template` query parameter works with templates stored in an `ISSUE_TEMPLATE` subdirectory within the root, `docs/` or `.github/` directory in a repository. For more information, see "[AUTOTITLE](/communities/using-templates-to-encourage-useful-issues-and-pull-requests)."
170170

171171
{% ifversion fpt or ghec %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ability to set a default in issue form dropdowns (#11231)
2+
versions:
3+
fpt: '*'
4+
ghec: '*'
5+
ghes: '>=3.11'
6+
ghae: '>=3.11'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ability to set projects in issue forms (#11231)
2+
versions:
3+
fpt: '*'
4+
ghec: '*'
5+
ghes: '>=3.11'
6+
ghae: '>=3.11'

data/reusables/community/issue-forms-sample.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
name: Bug Report
33
description: File a bug report
44
title: "[Bug]: "
5-
labels: ["bug", "triage"]
5+
labels: ["bug", "triage"]{% ifversion projects-in-issue-forms %}
6+
projects: ["octo-org/1", "octo-org/44"]{% endif %}
67
assignees:
78
- octocat
89
body:
@@ -34,7 +35,8 @@ body:
3435
description: What version of our software are you running?
3536
options:
3637
- 1.0.2 (Default)
37-
- 1.0.3 (Edge)
38+
- 1.0.3 (Edge){% ifversion issue-form-dropdown-defaults %}
39+
default: 0{% endif %}
3840
validations:
3941
required: true
4042
- type: dropdown

package-lock.json

Lines changed: 40 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"dependencies": {
5959
"@elastic/elasticsearch": "7.11.0",
6060
"@github/failbot": "0.8.3",
61+
"@octokit/request-error": "5.0.0",
6162
"@primer/behaviors": "^1.3.3",
6263
"@primer/css": "^21.0.1",
6364
"@primer/octicons": "^19.1.0",

0 commit comments

Comments
 (0)