Skip to content

Commit c3afc1f

Browse files
Workflow
1 parent 4e01ed2 commit c3afc1f

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/close_issue_in_other_repo

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Close Matching Issue on PR Merge
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
close_issue:
10+
if: github.event.pull_request.merged == true
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Extract PR Title in Lowercase
15+
id: extract_title
16+
run: echo "title=$(echo '${{ github.event.pull_request.title }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
17+
18+
- name: Search for Issue with Matching Title
19+
id: find_issue
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: |
23+
ISSUE=$(gh issue list --repo community-scripts/ProxmoxVED --search "$title" --json number --jq '.[0].number')
24+
if [ -n "$ISSUE" ]; then
25+
echo "issue_number=$ISSUE" >> $GITHUB_ENV
26+
else
27+
echo "No matching issue found."
28+
exit 0
29+
fi
30+
31+
- name: Comment on Issue and Close It
32+
if: env.issue_number != ''
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
gh issue comment $issue_number --repo community-scripts/ProxmoxVED --body "Merged with #${{ github.event.pull_request.number }} in ProxmoxVE"
37+
gh issue close $issue_number --repo community-scripts/ProxmoxVED

0 commit comments

Comments
 (0)