chore: bump globals from 15.11.0 to 15.13.0 in /apps/main-cli #108
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: Comment on PR Closure and Close Related Issue | |
on: | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
close_issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check PR Merge Status | |
id: pr_status | |
run: echo "::set-output name=merged::${{ github.event.pull_request.merged }}" | |
- name: Close related issue if PR is merged | |
if: steps.pr_status.outputs.merged == 'true' | |
uses: actions/github-script@v4 | |
with: | |
github-token: ${{ secrets.MY_SEC }} | |
script: | | |
const { owner, repo, number } = context.issue; | |
const linkedIssues = context.payload.pull_request.body.match(/#\d+/g); // Find issue numbers in the PR body (e.g. "closes #123") | |
if (linkedIssues) { | |
for (const issue of linkedIssues) { | |
const issue_number = issue.replace('#', ''); // Extract issue number | |
await github.issues.update({ | |
owner, | |
repo, | |
issue_number, | |
state: 'closed' | |
}); | |
console.log(`Closed issue: ${issue}`); | |
} | |
} | |
console.log('No linked issues found in the PR body.'); |