slawekjaranowski commented on code in PR #221:
URL: 
https://github.com/apache/maven-gh-actions-shared/pull/221#discussion_r2554817664


##########
.github/workflows/release-drafter.yml:
##########
@@ -98,3 +102,87 @@ jobs:
       - name: Verify release drafter status
         if: steps.release-drafter.outputs.id == ''
         run: exit 1
+
+  milestones-managment:
+    name: Milestones Management
+    needs: detect-version
+    permissions:
+      # write permission is required to manage milestones
+      issues: write
+    runs-on: ubuntu-latest
+    # execute only on next development commits
+    if: >
+      needs.detect-version.outputs.version != '' &&
+      startsWith(github.event.head_commit.message , '[maven-release-plugin] 
prepare for next development iteration')
+
+    steps:
+      - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # 
v8.0.0
+        env:
+          CURRENT_VERSION: ${{ needs.detect-version.outputs.version }}
+        with:
+          script: |
+            const branch = context.ref.replace('refs/heads/', '');
+            const version = process.env.CURRENT_VERSION;
+            
+            console.log('branch: ' + branch);
+            console.log('version: ' + version);
+            
+            const milestones = await github.rest.issues.listMilestones({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              state: 'open'
+            });
+            
+            console.log('All open milestones: ');
+            console.log(milestones.data);
+            
+            var milestone;
+            if (milestones.data.length > 1) {
+              milestone = milestones.data.find(({description}) => 
description?.includes('branch: ' + branch));
+            } else {
+              milestone = milestones.data[0];

Review Comment:
   ok, I will take here only when exactly one milestone will be available



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to