Skip to content

Repo sync #27365

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 2 commits into from
Aug 10, 2023
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
31 changes: 24 additions & 7 deletions .github/actions-scripts/purge-old-workflow-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import fs from 'fs'
import assert from 'node:assert/strict'

import { getOctokit } from '@actions/github'
import { RequestError } from '@octokit/request-error'

main()
async function main() {
Expand All @@ -51,10 +52,12 @@ async function main() {
repo,
})

const validWorkflows = allWorkflows.filter((w) => !w.path.startsWith('dynamic/'))

const sortByDate = (a, b) => a.updated_at.localeCompare(b.updated_at)
const workflows = [
...allWorkflows.filter((w) => !fs.existsSync(w.path)).sort(sortByDate),
...allWorkflows.filter((w) => fs.existsSync(w.path)).sort(sortByDate),
...validWorkflows.filter((w) => !fs.existsSync(w.path)).sort(sortByDate),
...validWorkflows.filter((w) => fs.existsSync(w.path)).sort(sortByDate),
]

let deletions = 0
Expand All @@ -65,11 +68,25 @@ async function main() {
? `${workflow.path} still exists on disk`
: `${workflow.path} no longer exists on disk`,
)
deletions += await deleteWorkflowRuns(github, owner, repo, workflow, {
dryRun: DRY_RUN,
minAgeDays: MIN_AGE_DAYS,
maxDeletions: MAX_DELETIONS - deletions,
})
try {
deletions += await deleteWorkflowRuns(github, owner, repo, workflow, {
dryRun: DRY_RUN,
minAgeDays: MIN_AGE_DAYS,
maxDeletions: MAX_DELETIONS - deletions,
})
} catch (error) {
// Generally, if it fails, it's because of a network error or
// because busy servers. It's not our fault, but considering that
// this script is supposed to run on frequent schedule, we don't
// need to fret. We'll just try again next time.
if (error instanceof RequestError && error.status >= 500) {
console.log(`RequestError: ${error.message}`)
console.log(` status: ${error.status}`)
break
} else {
throw error
}
}

if (deletions >= MAX_DELETIONS) {
console.log(`Reached max number of deletions: ${MAX_DELETIONS}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For example, the following form definition includes four form elements: a text a
multiple: false
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
- 1.0.3 (Edge){% ifversion issue-form-dropdown-defaults %}
default: 0{% endif %}
validations:
required: true
- type: checkboxes
Expand Down Expand Up @@ -203,6 +204,7 @@ You can use a `dropdown` element to add a dropdown menu in your form.
| `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" %} |
| `multiple` | Determines if the user can select more than one option. | {% octicon "x" aria-label="Optional" %} | Boolean | false | {% octicon "dash" aria-label="Not applicable" %} |
| `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" %} |
| `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" %} |

#### Validations for `dropdown`

Expand All @@ -221,10 +223,11 @@ body:
attributes:
label: How did you download the software?
options:
- Built from source
- Homebrew
- MacPorts
- apt-get
- Built from source
- apt-get{% ifversion issue-form-dropdown-defaults %}
default: 0{% endif %}
validations:
required: true
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ You can set the following top-level keys for each issue form.
| `body` | Definition of the input types in the form. | Required | Array |
| `assignees` | People who will be automatically assigned to issues created with this template. | Optional | Array or comma-delimited string |
| `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 |
| `title` | A default title that will be pre-populated in the issue submission form. | Optional | String |
| `title` | A default title that will be pre-populated in the issue submission form. | Optional | String |{% ifversion projects-in-issue-forms %}
| `projects` | Projects that any issues created with this template will automatically be added to. | Optional | Array or comma-delimited string |{% endif %}


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)."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Query parameter | Example
`labels` | `https://github.com/octo-org/octo-repo/issues/new?labels=help+wanted,bug` creates an issue with the labels "help wanted" and "bug".
`milestone` | `https://github.com/octo-org/octo-repo/issues/new?milestone=testing+milestones` creates an issue with the milestone "testing milestones."
`assignees` | `https://github.com/octo-org/octo-repo/issues/new?assignees=octocat` creates an issue and assigns it to @octocat.
`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.
`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 %}
`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)."

{% ifversion fpt or ghec %}
Expand Down
6 changes: 6 additions & 0 deletions data/features/issue-form-dropdown-defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ability to set a default in issue form dropdowns (#11231)
versions:
fpt: '*'
ghec: '*'
ghes: '>=3.11'
ghae: '>=3.11'
6 changes: 6 additions & 0 deletions data/features/projects-in-issue-forms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ability to set projects in issue forms (#11231)
versions:
fpt: '*'
ghec: '*'
ghes: '>=3.11'
ghae: '>=3.11'
6 changes: 4 additions & 2 deletions data/reusables/community/issue-forms-sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]
labels: ["bug", "triage"]{% ifversion projects-in-issue-forms %}
projects: ["octo-org/1", "octo-org/44"]{% endif %}
assignees:
- octocat
body:
Expand Down Expand Up @@ -34,7 +35,8 @@ body:
description: What version of our software are you running?
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
- 1.0.3 (Edge){% ifversion issue-form-dropdown-defaults %}
default: 0{% endif %}
validations:
required: true
- type: dropdown
Expand Down
42 changes: 40 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"dependencies": {
"@elastic/elasticsearch": "7.11.0",
"@github/failbot": "0.8.3",
"@octokit/request-error": "5.0.0",
"@primer/behaviors": "^1.3.3",
"@primer/css": "^21.0.1",
"@primer/octicons": "^19.1.0",
Expand Down