chore(other): release 1.5.0-alpha.12 #6826 #3260
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 "for test" Label | |
on: | |
pull_request_target: | |
types: | |
- closed | |
permissions: | |
pull-requests: read | |
issues: write | |
jobs: | |
add_label: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-20.04 | |
outputs: | |
issue_id_list: ${{ steps.pr-commits.outputs.issue_id_list }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get PR commits messages | |
id: pr-commits | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { data: commits } = await github.rest.pulls.listCommits({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: ${{ github.event.number }} | |
}); | |
const messages = commits.map(commit => commit.commit.message); | |
console.log(messages.join("\n")); | |
const regex = /#(\d+)/g; | |
const issue_id_list = messages.join("\n").match(regex).map(match => match.replace("#", "")); | |
console.log(issue_id_list); | |
core.setOutput("issue_id_list", issue_id_list); | |
- name: Add label to issues | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
for (const issue_id of ${{ steps.pr-commits.outputs.issue_id_list }}) { | |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue_id | |
}); | |
const todo_label = labels.find(label => label.name === "todo"); | |
if (todo_label) { | |
github.rest.issues.removeLabel({ | |
issue_number: issue_id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: "todo" | |
}); | |
} | |
github.rest.issues.addLabels({ | |
issue_number: issue_id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["for test"] | |
}); | |
} | |
- name: Close Issue | |
uses: peter-evans/close-issue@v3 | |
with: | |
issue-number: 1 | |
comment: Auto-closing issue | |
close_issue: | |
needs: add_label | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
issue_id: ${{ fromJSON(needs.add_label.outputs.issue_id_list) }} | |
steps: | |
- name: Close Issue ${{ matrix.issue_id }} | |
uses: peter-evans/close-issue@v3 | |
with: | |
issue-number: ${{ matrix.issue_id }} | |
comment: Auto close issue after pr merged \#${{ github.event.number }} | |