Bump quarkiverse-groovy.version from 3.12.0 to 3.12.1 #676
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
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Assign Issue Milestone | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'CHANGELOG.md' | |
- 'camel-quarkus-sbom/**' | |
permissions: | |
contents: read | |
issues: write | |
jobs: | |
assign-issue-milestone: | |
if: github.repository == 'apache/camel-quarkus' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assign Closed Issues To Latest Milestone | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const issueNumberFromCommitCommentRegex = new RegExp(`.*(?:fix(?:e[sd])?|(?:(?:resolve|close)[sd]?)):?\\s(?:https?:\\/\\/github\\.com\\/${context.repo.owner}\\/${context.repo.repo}\\/issues\\/|#)(\\d+)`, 'igm'); | |
const issueNumbers = new Set(); | |
// Get the commits that triggered this push event | |
const commitComparison = await github.rest.repos.compareCommitsWithBasehead({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
basehead: `${context.payload.before}...${context.payload.after}`, | |
}); | |
if (commitComparison && commitComparison.data) { | |
// Parse issue number references from commit comments | |
commitComparison.data.commits.forEach(commitData => { | |
for (const match of commitData.commit.message.matchAll(issueNumberFromCommitCommentRegex)) { | |
let issueNumber = parseInt(match[1]); | |
if (!isNaN(issueNumber)) { | |
issueNumbers.add(issueNumber); | |
} | |
} | |
}); | |
} | |
// No issues associated with the merged PR so we can exit | |
if (issueNumbers.size === 0) { | |
return; | |
} | |
// Get open milestones | |
milestoneResults = await github.rest.issues.listMilestones({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
sort: "title", | |
direction: "desc", | |
}); | |
// Assign the latest milestone to issues associated with the merged PR | |
if (milestoneResults && milestoneResults.data.length > 0) { | |
const milestones = milestoneResults.data.filter(data => data.title.match("^[0-9]+.[0-9]+.[0-9]+.*")); | |
if (milestones && milestones.length > 0) { | |
const latestMilestone = milestones[0].number; | |
issueNumbers.forEach(issueNumber => { | |
github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issueNumber, | |
milestone: latestMilestone, | |
}); | |
}); | |
} | |
} |