1
0
mirror of synced 2026-01-05 12:07:35 -05:00

remove old automerge method (#22941)

This commit is contained in:
Rachael Sewell
2021-11-18 09:47:46 -08:00
committed by GitHub
parent 75577663e9
commit 5b8cb34e4b
7 changed files with 56 additions and 137 deletions

View File

@@ -1,42 +0,0 @@
name: Automerge
# **What it does**: Pull requests with label "automerge" or "autosquash" will automatically merge.
# **Why we have it**: While now this is a feature built into GitHub, we still use it as part of other automation.
# **Who does it impact**: Any workflows that depend on automerge or autosquash labels.
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
check_suite:
types:
- completed
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
if: (contains(github.event.pull_request.labels.*.name, 'automerge') || contains(github.event.pull_request.labels.*.name, 'autosquash')) && (github.repository == 'github/docs-internal' || github.repository == 'github/docs')
steps:
- name: automerge
uses: 'pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07'
env:
GITHUB_TOKEN: '${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}'
MERGE_METHOD_LABELS: 'automerge=merge,autosquash=squash'
MERGE_COMMIT_MESSAGE: 'pull-request-title'
MERGE_METHOD: 'merge'
MERGE_FORKS: 'true'
MERGE_RETRIES: '50'
MERGE_RETRY_SLEEP: '10000' # ten seconds
UPDATE_LABELS: 'automerge,autosquash'
UPDATE_METHOD: 'merge'
HUSKY: '0' # Disable pre-commit hooks

View File

@@ -64,10 +64,16 @@ jobs:
"Hello! The GitHub Enterprise Server release dates have changed.\n\n
If CI passes, this PR will be auto-merged. :green_heart:\n\n
If CI does not pass or other problems arise, contact #docs-engineering on slack.\n\nThis PR was 🤖-crafted by `.github/workflows/enterprise-dates.yml`. 🧶"
labels: automerge,autoupdate
labels: autoupdate
branch: enterprise-server-dates-update
delete-branch: true
- name: Enable GitHub auto-merge
if: ${{ steps.create-pull-request.outputs.pull-request-number }}
env:
AUTOMERGE_PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
run: node .github/actions-scripts/enable-automerge.js
- if: ${{ failure() && env.FREEZE != 'true' }}
name: Delete remote branch (if previous steps failed)
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911

View File

@@ -216,38 +216,9 @@ jobs:
- name: Enable GitHub auto-merge
if: ${{ steps.find-pull-request.outputs.number }}
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
with:
github-token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
script: |
const pull = await github.pulls.get({
...context.repo,
pull_number: parseInt(${{ steps.find-pull-request.outputs.number }})
})
const pullNodeId = pull.data.node_id
console.log(`Pull request GraphQL Node ID: ${pullNodeId}`)
const mutation = `mutation ($id: ID!) {
enablePullRequestAutoMerge(input: {
pullRequestId: $id,
mergeMethod: MERGE
}) {
clientMutationId
}
}`
const variables = {
id: pullNodeId
}
const graph = await github.graphql(mutation, variables)
console.log('GraphQL mutation result:\n' + JSON.stringify(graph))
if (graph.errors && graph.errors.length > 0) {
console.error('ERROR! Failed to enable auto-merge:\n - ' + graph.errors.map(error => error.message).join('\n - '))
} else {
console.log('Auto-merge enabled!')
}
env:
AUTOMERGE_PR_NUMBER: ${{ steps.find-pull-request.outputs.number }}
run: node .github/actions-scripts/enable-automerge.js
- name: Send Slack notification if workflow fails
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340

View File

@@ -1,60 +0,0 @@
name: Translations
# **What it does**:
# **Why we have it**:
# **Who does it impact**: Docs localization
on:
schedule:
- cron: '20 19 * * *' # once a day at 19:20 UTC / 11:20 PST
permissions:
pull-requests: write
env:
FREEZE: ${{ secrets.FREEZE }}
jobs:
prepare:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- if: ${{ env.FREEZE == 'true' }}
run: |
echo 'The repo is currently frozen! Exiting this workflow.'
exit 1 # prevents further steps from running
- name: Find original Pull Request
uses: juliangruber/find-pull-request-action@db875662766249c049b2dcd85293892d61cb0b51
id: pr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: translations
base: main
author: octoglot
state: open
- if: ${{ steps.pr.outputs.number }}
name: Check if already labeled
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
id: has-label
with:
script: |
const { data: labels } = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.pr.outputs.number }}
})
if (labels.find(label => label.name === 'automerge')) {
return 'ok'
}
- if: ${{ !steps.has-label.outputs.result }}
name: Approve Pull Request
uses: juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.pr.outputs.number }}
- if: ${{ !steps.has-label.outputs.result }}
name: Add automerge label
uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90
with:
issue-number: ${{ steps.pr.outputs.number }}
add-labels: 'automerge'

View File

@@ -58,9 +58,15 @@ jobs:
syncs up the GraphQL data in this repo.\n\n
If CI passes, this PR will be auto-merged. :green_heart:\n\n
If CI does not pass or other problems arise, contact #docs-engineering on slack."
labels: automerge,autoupdate
labels: autoupdate
branch: graphql-schema-update
- name: Enable GitHub auto-merge
if: ${{ steps.create-pull-request.outputs.pull-request-number }}
env:
AUTOMERGE_PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
run: node .github/actions-scripts/enable-automerge.js
- if: ${{ failure() && env.FREEZE != 'true'}}
name: Delete remote branch (if previous steps failed)
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911