-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
2,084 additions
and
638 deletions.
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
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,33 @@ | ||
name: Heylogs | ||
|
||
on: [ push ] | ||
|
||
jobs: | ||
badge-job: | ||
if: startsWith(github.repository, 'nbbrd/') && startsWith(github.ref, 'refs/heads/develop') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
cache: 'maven' | ||
|
||
- name: Scan changelog | ||
run: mvn -B -ntp -U com.github.nbbrd.heylogs:heylogs-maven-plugin::scan -Dheylogs.output.file=scan.json -Dheylogs.format.id=json | ||
|
||
- name: Create badges endpoint json | ||
run: | | ||
mkdir heylogs | ||
jq '{schemaVersion: 1, label: "unreleased changes", message: "#\(.[0].summary.unreleasedChanges)", color: "E05735", logoColor: "white", namedLogo: "keepachangelog"}' scan.json > heylogs/unreleased-changes.json | ||
- name: Deploy badges endpoint json | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_branch: badges | ||
publish_dir: ./heylogs |
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
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
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
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
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
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
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
61 changes: 61 additions & 0 deletions
61
heylogs-api/src/main/java/internal/heylogs/VersionNode.java
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,61 @@ | ||
package internal.heylogs; | ||
|
||
import com.vladsch.flexmark.ast.Heading; | ||
import com.vladsch.flexmark.ast.Reference; | ||
import com.vladsch.flexmark.ast.util.ReferenceRepository; | ||
import com.vladsch.flexmark.util.ast.Document; | ||
import lombok.NonNull; | ||
import nbbrd.heylogs.Nodes; | ||
import nbbrd.heylogs.Version; | ||
|
||
import java.net.URL; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
|
||
@lombok.Value | ||
public class VersionNode { | ||
|
||
@NonNull | ||
Heading heading; | ||
|
||
@NonNull | ||
Version version; | ||
|
||
@NonNull | ||
Reference reference; | ||
|
||
public static VersionNode of(Version version, URL url) { | ||
return new VersionNode( | ||
version.toHeading(), version, | ||
ChangelogNodes.newReference(version, url)); | ||
} | ||
|
||
public static List<VersionNode> allOf(Document document, ReferenceRepository repository) { | ||
return Nodes.of(Heading.class) | ||
.descendants(document) | ||
.filter(Version::isVersionLevel) | ||
.map(heading -> { | ||
try { | ||
Version version = Version.parse(heading); | ||
return new VersionNode(heading, version, Objects.requireNonNull(repository.getFromRaw(version.getRef()))); | ||
} catch (RuntimeException ex) { | ||
return null; | ||
} | ||
}) | ||
.filter(Objects::nonNull) | ||
.collect(toList()); | ||
} | ||
|
||
public static Optional<VersionNode> findUnreleased(List<VersionNode> list) { | ||
return list.stream() | ||
.filter(versionNode -> versionNode.getVersion().isUnreleased()) | ||
.findFirst(); | ||
} | ||
|
||
public URL getURL() { | ||
return URLExtractor.urlOf(getReference().getUrl()); | ||
} | ||
} |
Oops, something went wrong.