зеркало из https://github.com/github/docs.git
Update Microsoft translation workflow to auto approve and merge translation PRs (#30231)
This commit is contained in:
Родитель
d21afee935
Коммит
b35230f517
|
@ -107,14 +107,14 @@ async function findOrCreatePullRequest(config) {
|
|||
* @param {object} config Configuration options for labeling the PR
|
||||
* @returns {Promise<undefined>}
|
||||
*/
|
||||
async function labelPullRequest(config) {
|
||||
await octokit.rest.issues.update({
|
||||
owner: config.owner,
|
||||
repo: config.repo,
|
||||
issue_number: config.issue_number,
|
||||
labels: config.labels,
|
||||
})
|
||||
}
|
||||
// async function labelPullRequest(config) {
|
||||
// await octokit.rest.issues.update({
|
||||
// owner: config.owner,
|
||||
// repo: config.repo,
|
||||
// issue_number: config.issue_number,
|
||||
// labels: config.labels,
|
||||
// })
|
||||
// }
|
||||
|
||||
async function main() {
|
||||
const options = {
|
||||
|
@ -135,8 +135,8 @@ async function main() {
|
|||
|
||||
// metadata parameters aren't currently available in `github.rest.pulls.create`,
|
||||
// but they are in `github.rest.issues.update`.
|
||||
await labelPullRequest(options)
|
||||
console.log(`Updated ${pr} with these labels: ${options.labels.join(', ')}`)
|
||||
// await labelPullRequest(options)
|
||||
// console.log(`Updated ${pr} with these labels: ${options.labels.join(', ')}`)
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
|
@ -107,14 +107,14 @@ async function findOrCreatePullRequest(config) {
|
|||
* @param {object} config Configuration options for labeling the PR
|
||||
* @returns {Promise<undefined>}
|
||||
*/
|
||||
// async function labelPullRequest(config) {
|
||||
// await octokit.rest.issues.update({
|
||||
// owner: config.owner,
|
||||
// repo: config.repo,
|
||||
// issue_number: config.issue_number,
|
||||
// labels: config.labels,
|
||||
// })
|
||||
// }
|
||||
async function labelPullRequest(config) {
|
||||
await octokit.rest.issues.update({
|
||||
owner: config.owner,
|
||||
repo: config.repo,
|
||||
issue_number: config.issue_number,
|
||||
labels: config.labels,
|
||||
})
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const options = {
|
||||
|
@ -135,8 +135,8 @@ async function main() {
|
|||
|
||||
// metadata parameters aren't currently available in `github.rest.pulls.create`,
|
||||
// but they are in `github.rest.issues.update`.
|
||||
// await labelPullRequest(options)
|
||||
// console.log(`Updated ${pr} with these labels: ${options.labels.join(', ')}`)
|
||||
await labelPullRequest(options)
|
||||
console.log(`Updated ${pr} with these labels: ${options.labels.join(', ')}`)
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
|
@ -10,8 +10,8 @@ name: Create translation Batch Pull Request
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '02 17 * * *' # Once a day at 17:02 UTC / 9:02 PST
|
||||
# schedule:
|
||||
# - cron: '02 17 * * *' # Once a day at 17:02 UTC / 9:02 PST
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -172,11 +172,11 @@ jobs:
|
|||
- name: Push filtered translations
|
||||
run: git push origin ${{ steps.set-branch.outputs.BRANCH_NAME }}
|
||||
|
||||
- name: Close existing stale batches
|
||||
uses: lee-dohm/close-matching-issues@e9e43aad2fa6f06a058cedfd8fb975fd93b56d8f
|
||||
with:
|
||||
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
query: 'type:pr label:translation-batch-${{ matrix.language }}'
|
||||
# - name: Close existing stale batches
|
||||
# uses: lee-dohm/close-matching-issues@e9e43aad2fa6f06a058cedfd8fb975fd93b56d8f
|
||||
# with:
|
||||
# token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
# query: 'type:pr label:translation-batch-${{ matrix.language }}'
|
||||
|
||||
- name: Create translation batch pull request
|
||||
env:
|
||||
|
@ -188,35 +188,35 @@ jobs:
|
|||
BODY_FILE: '/tmp/pr-body.txt'
|
||||
run: .github/actions-scripts/create-translation-batch-pr.js
|
||||
|
||||
- name: Approve PR
|
||||
if: github.ref_name == 'main'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
run: gh pr review --approve || echo "Nothing to approve"
|
||||
# - name: Approve PR
|
||||
# if: github.ref_name == 'main'
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
# run: gh pr review --approve || echo "Nothing to approve"
|
||||
|
||||
- name: Set auto-merge
|
||||
if: github.ref_name == 'main'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
run: gh pr merge ${{ steps.set-branch.outputs.BRANCH_NAME }} --auto --squash || echo "Nothing to merge"
|
||||
# - name: Set auto-merge
|
||||
# if: github.ref_name == 'main'
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
# run: gh pr merge ${{ steps.set-branch.outputs.BRANCH_NAME }} --auto --squash || echo "Nothing to merge"
|
||||
|
||||
# When the maximum execution time is reached for this job, Actions cancels the workflow run.
|
||||
# This emits a notification for the first responder to triage.
|
||||
- name: Send Slack notification if workflow is cancelled
|
||||
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
if: cancelled()
|
||||
with:
|
||||
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
color: failure
|
||||
text: 'The new translation batch for ${{ matrix.language }} was cancelled.'
|
||||
# # When the maximum execution time is reached for this job, Actions cancels the workflow run.
|
||||
# # This emits a notification for the first responder to triage.
|
||||
# - name: Send Slack notification if workflow is cancelled
|
||||
# uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
# if: cancelled()
|
||||
# with:
|
||||
# channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
# bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
# color: failure
|
||||
# text: 'The new translation batch for ${{ matrix.language }} was cancelled.'
|
||||
|
||||
# Emit a notification for the first responder to triage if the workflow failed.
|
||||
- name: Send Slack notification if workflow failed
|
||||
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
if: failure()
|
||||
with:
|
||||
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
color: failure
|
||||
text: 'The new translation batch for ${{ matrix.language }} failed.'
|
||||
# # Emit a notification for the first responder to triage if the workflow failed.
|
||||
# - name: Send Slack notification if workflow failed
|
||||
# uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
# if: failure()
|
||||
# with:
|
||||
# channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
# bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
# color: failure
|
||||
# text: 'The new translation batch for ${{ matrix.language }} failed.'
|
||||
|
|
|
@ -10,9 +10,8 @@ name: Create translation Batch Pull Request (Microsoft)
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# TODO: bring schedule back in
|
||||
# schedule:
|
||||
# - cron: '02 17 * * *' # Once a day at 17:02 UTC / 9:02 PST
|
||||
schedule:
|
||||
- cron: '02 17 * * *' # Once a day at 17:02 UTC / 9:02 PST
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -145,14 +144,12 @@ jobs:
|
|||
- name: Push filtered translations
|
||||
run: git push origin ${{ steps.set-branch.outputs.BRANCH_NAME }}
|
||||
|
||||
# TODO: bring this step back
|
||||
# - name: Close existing stale batches
|
||||
# uses: lee-dohm/close-matching-issues@e9e43aad2fa6f06a058cedfd8fb975fd93b56d8f
|
||||
# with:
|
||||
# token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
# query: 'type:pr label:translation-batch-${{ matrix.language }}'
|
||||
- name: Close existing stale batches
|
||||
uses: lee-dohm/close-matching-issues@e9e43aad2fa6f06a058cedfd8fb975fd93b56d8f
|
||||
with:
|
||||
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
query: 'type:pr label:translation-batch-${{ matrix.language }}'
|
||||
|
||||
# TODO: bring labels back into the PR script
|
||||
- name: Create translation batch pull request
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
|
@ -163,36 +160,35 @@ jobs:
|
|||
BODY_FILE: '/tmp/pr-body.txt'
|
||||
run: .github/actions-scripts/msft-create-translation-batch-pr.js
|
||||
|
||||
# TODO: bring back these steps
|
||||
# - name: Approve PR
|
||||
# if: github.ref_name == 'main'
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
# run: gh pr review --approve || echo "Nothing to approve"
|
||||
- name: Approve PR
|
||||
if: github.ref_name == 'main'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
run: gh pr review --approve || echo "Nothing to approve"
|
||||
|
||||
# - name: Set auto-merge
|
||||
# if: github.ref_name == 'main'
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
# run: gh pr merge ${{ steps.set-branch.outputs.BRANCH_NAME }} --auto --squash || echo "Nothing to merge"
|
||||
- name: Set auto-merge
|
||||
if: github.ref_name == 'main'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
|
||||
run: gh pr merge ${{ steps.set-branch.outputs.BRANCH_NAME }} --auto --squash || echo "Nothing to merge"
|
||||
|
||||
# # When the maximum execution time is reached for this job, Actions cancels the workflow run.
|
||||
# # This emits a notification for the first responder to triage.
|
||||
# - name: Send Slack notification if workflow is cancelled
|
||||
# uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
# if: cancelled()
|
||||
# with:
|
||||
# channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
# bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
# color: failure
|
||||
# text: 'The new translation batch for ${{ matrix.language }} was cancelled.'
|
||||
# When the maximum execution time is reached for this job, Actions cancels the workflow run.
|
||||
# This emits a notification for the first responder to triage.
|
||||
- name: Send Slack notification if workflow is cancelled
|
||||
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
if: cancelled()
|
||||
with:
|
||||
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}🎉
|
||||
color: failure
|
||||
text: 'The new translation batch for ${{ matrix.language }} was cancelled.'
|
||||
|
||||
# # Emit a notification for the first responder to triage if the workflow failed.
|
||||
# - name: Send Slack notification if workflow failed
|
||||
# uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
# if: failure()
|
||||
# with:
|
||||
# channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
# bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
# color: failure
|
||||
# text: 'The new translation batch for ${{ matrix.language }} failed.'
|
||||
# Emit a notification for the first responder to triage if the workflow failed.
|
||||
- name: Send Slack notification if workflow failed
|
||||
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
|
||||
if: failure()
|
||||
with:
|
||||
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
||||
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
||||
color: failure
|
||||
text: 'The new translation batch for ${{ matrix.language }} failed.'
|
||||
|
|
Загрузка…
Ссылка в новой задаче