@@ -100,6 +100,35 @@ jobs:
100
100
git tag $NEW_VERSION
101
101
git push origin main --tags
102
102
103
+ - name : Label linked issues as merged
104
+ if : github.event.pull_request.merged == true && github.ref == 'refs/heads/main'
105
+ uses : actions/github-script@v5
106
+ with :
107
+ github-token : ${{ secrets.GITHUB_TOKEN }}
108
+ script : |
109
+ const github = require('@actions/github');
110
+ const context = github.context;
111
+ const pullRequest = context.payload.pull_request;
112
+
113
+ // Regex to extract linked issue numbers from PR body
114
+ const issueRegex = /(?:fixes|resolves|closes) #(\d+)/gi;
115
+ let match;
116
+ const issueNumbers = [];
117
+
118
+ while ((match = issueRegex.exec(pullRequest.body)) !== null) {
119
+ issueNumbers.push(match[1]);
120
+ }
121
+
122
+ // Add a label to each linked issue
123
+ for (const issueNumber of issueNumbers) {
124
+ await github.rest.issues.addLabels({
125
+ owner: context.repo.owner,
126
+ repo: context.repo.repo,
127
+ issue_number: issueNumber,
128
+ labels: ['merged to main']
129
+ });
130
+ }
131
+
103
132
- name : Generate changelog
104
133
if : steps.check.outputs.skip != 'true'
105
134
uses :
heinrichreimer/[email protected]
0 commit comments