replication: cherry-pick improvements for dr-autosync #2537
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add Labels | |
on: | |
pull_request_target: | |
types: [opened, reopened] | |
jobs: | |
add_labels: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v4 | |
name: Add labels | |
with: | |
script: | | |
function doAddLabels(labels) { | |
console.log("Adding labels", labels); | |
return github.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: labels, | |
}); | |
} | |
async function run() { | |
const { title } = context.payload.pull_request; | |
if (title.startsWith("Update TiDB Dashboard to")) { | |
await doAddLabels(["component/visualization", "require-LGT1"]); | |
return; | |
} | |
console.log("Not matching any label rules, skip"); | |
} | |
run().catch(e => { | |
// Do not fail on errors | |
console.error("Errors: ", e.stack); | |
}) |