-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Library Versions Dependabot #565
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,10 +135,25 @@ jobs: | |
steps: | ||
- name: "☁️ Checkout repository" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup java" | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'oracle' | ||
java-version: '21' | ||
- name: "✏️ PR for supported versions" | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Github Actions" | ||
git fetch origin check-new-library-versions/$(date '+%Y-%m-%d') | ||
git checkout check-new-library-versions/$(date '+%Y-%m-%d') | ||
gh pr create --title "Update supported library versions" --body "This pull request updates supported versions of the existing libraries in the repo" | ||
- name: "✏️ Edit issue for unsupported versions" | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Github Actions" | ||
ALL_COMMENTS=$(gh issue view "${{ needs.get-all-libraries.outputs.issue }}" --comments) | ||
|
||
FORMATTED_BODY=$(./gradlew -q extractLibrariesGroupsFromGithubComments --comments="$ALL_COMMENTS") | ||
gh issue create --title "List unsupported libraries versions" --body "$FORMATTED_BODY" | ||
|
||
gh issue close "${{ needs.get-all-libraries.outputs.issue }}" |
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
58 changes: 58 additions & 0 deletions
58
...c/src/main/groovy/org/graalvm/internal/tck/harness/tasks/GroupUnsupportedLibraries.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.graalvm.internal.tck.harness.tasks | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.TaskAction | ||
import org.gradle.api.tasks.options.Option | ||
import org.gradle.util.internal.VersionNumber | ||
|
||
import java.util.regex.Matcher | ||
import java.util.regex.Pattern | ||
|
||
abstract class GroupUnsupportedLibraries extends DefaultTask { | ||
|
||
@Input | ||
@Option(option = "comments", description = "Provides github comments for library grouping as string.") | ||
abstract Property<String> getGithubComments() | ||
|
||
@TaskAction | ||
void action() { | ||
def pattern = Pattern.compile("--[\n ](.*?)[\n ]--") | ||
def matcher = pattern.matcher(getGithubComments().get()) | ||
|
||
def libraryGroups = new HashMap<String, List<String>>() | ||
while (matcher.find()) { | ||
def coordinates = matcher.group(1) | ||
def coordinatesPart = coordinates.split(":") | ||
def artifactKey = coordinatesPart[0] + ":" + coordinatesPart[1] | ||
def version = coordinatesPart[2] | ||
|
||
if (libraryGroups.get(artifactKey) == null) { | ||
libraryGroups.put(artifactKey, new ArrayList<String>()) | ||
} | ||
|
||
libraryGroups.get(artifactKey).add(version) | ||
libraryGroups.get(artifactKey).sort(Comparator.comparing(VersionNumber::parse)) | ||
} | ||
|
||
print generateGroupedComment(libraryGroups) | ||
} | ||
|
||
private static String generateGroupedComment(Map<String, List<String>> groups) { | ||
def sb = new StringBuilder("List of all unsupported libraries:\n") | ||
|
||
for (String library : groups.keySet()) { | ||
sb.append("- ").append(library).append(":\n") | ||
|
||
for (String version : groups.get(library)) { | ||
sb.append("\t").append("- ").append(version).append("\n") | ||
} | ||
|
||
sb.append("\n") | ||
} | ||
|
||
return sb.toString() | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this create new a new issue every time the action runs or will the issue update if it already exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will create an issue every time we run the action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do that. We need to keep the updated one. That is why I proposed an issue per library that is updated over slack.