1
0
mirror of synced 2026-01-06 06:02:35 -05:00

Merge pull request #10074 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-09-15 11:34:38 -04:00
committed by GitHub
6 changed files with 17 additions and 26 deletions

View File

@@ -10,7 +10,6 @@ on:
- opened
- reopened
- synchronize
- unlocked
permissions:
contents: read

View File

@@ -10,7 +10,6 @@ on:
- opened
- reopened
- synchronize
- unlocked
permissions:
contents: read

View File

@@ -8,7 +8,6 @@ on:
pull_request_target:
types:
- closed
- locked
permissions:
contents: read

View File

@@ -29,6 +29,8 @@ Personal access tokens (PATs) are an alternative to using passwords for authenti
{% ifversion fpt %}{% data reusables.user_settings.removes-personal-access-tokens %}{% endif %}
A token with no assigned scopes can only access public information. To use your token to access repositories from the command line, select `repo`. For more information, see “[Available scopes](/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes)”.
## Creating a token
{% ifversion fpt %}1. [Verify your email address](/github/getting-started-with-github/verifying-your-email-address), if it hasn't been verified yet.{% endif %}

View File

@@ -106,7 +106,7 @@ If your instance has subdomain isolation disabled:
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/OWNER/*</url>
<url>HOSTNAME/_registry/maven/OWNER/*</url>
<snapshots>
<enabled>true</enabled>
</snapshots>

View File

@@ -60,20 +60,21 @@ export default async function undeployFromStaging({
// that checks for stale PRs. This way, we aren't doing more cleaning than
// necessary if someone intends to reopen the PR momentarily.
if (wasMerged) {
// Get the latest deployment environment to signal its deactivation
const { data: deployments } = await octokit.repos.listDeployments({
// Get all of the Deployments to signal this environment's complete deactivation
for await (const response of octokit.paginate.iterator(octokit.repos.listDeployments, {
owner,
repo,
// In the GitHub API, there can only be one active deployment per environment.
// For our many staging apps, we must use the unique appName as the environment.
environment: appName,
})
})) {
const { data: deployments } = response
if (deployments.length === 0) {
console.log('🚀 No deployments to deactivate!')
} else {
console.log(`Found ${deployments.length} GitHub Deployments`, deployments)
console.log(
`Found ${deployments.length} GitHub Deployments for Environment ${appName}`,
deployments
)
// Deactivate ALL of the deployments
for (const deployment of deployments) {
@@ -106,21 +107,12 @@ export default async function undeployFromStaging({
}
}
// Delete this Environment
try {
await octokit.repos.deleteAnEnvironment({
owner,
repo,
environment_name: appName,
})
console.log(`🚀 Environment (${appName}): deleted`)
} catch (error) {
if (error.status === 404) {
console.log(`🚀 Environment (${appName}): already deleted`)
} else {
throw error
}
}
// IMPORTANT:
// We will leave the Deployment Environment to be cleaned up later by the
// workflow that checks for stale PRs. This way, we are not doing more
// cleaning than necessary if someone intends to reopen the PR momentarily,
// and we do not need to use an admin PAT to run this script.
console.log(`🚀 Environment (${appName}) is ready to be removed (later...)`)
}
console.log(`Finished undeploying after ${Math.round((Date.now() - startTime) / 1000)} seconds`)