chore(deps): bump http from 1.2.2 to 1.3.0 in /frontend #103
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: Handle linked issues on PR merge | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
update-issues: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Add label to linked issues and leave a comment | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const pr = context.payload.pull_request; | |
if (pr.merged) { | |
const issueNumbers = []; | |
const regex = /\b(fix(es)?|close(s)?)\s+#(\d+)(,?\s*#\d+)*/gi; | |
let match; | |
while ((match = regex.exec(pr.body)) !== null) { | |
const issues = match[0].match(/#\d+/g).map(issue => issue.substring(1)); | |
issueNumbers.push(...issues); | |
} | |
for (const issueNumber of issueNumbers) { | |
// Add label to the issue | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issueNumber, | |
labels: ["Status: Completed"] | |
}); | |
// Get issue details | |
const issue = await github.rest.issues.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issueNumber, | |
}); | |
// Leave a comment on the issue | |
const author = issue.data.user.login; | |
const commentBody = `Hi @${author},\n\nThis task has been completed and will be implemented in the next project release.\n\nThank you for your contribution!\n\nIf you have any further questions or updates regarding this task, feel free to leave a comment below.`; | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issueNumber, | |
body: commentBody | |
}); | |
} | |
} |