Skip to content

Commit 97aa5fc

Browse files
committed
Improve date logic for GitHub recent contributors link
1 parent cf40503 commit 97aa5fc

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

buildSrc/src/main/groovy/org/grails/gradle/RenderSiteTask.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.grails.gradle
22

33
import edu.umd.cs.findbugs.annotations.Nullable
4+
import groovy.transform.CompileDynamic
45
import groovy.transform.CompileStatic
56
import org.grails.ContentAndMetadata
67
import org.grails.Page
@@ -20,6 +21,7 @@ import org.gradle.api.tasks.InputDirectory
2021
import org.gradle.api.tasks.OutputDirectory
2122
import org.gradle.api.tasks.TaskAction
2223
import static groovy.io.FileType.FILES
24+
import groovy.time.TimeCategory
2325

2426
import javax.annotation.Nonnull
2527
import javax.validation.constraints.NotNull
@@ -277,10 +279,22 @@ class RenderSiteTask extends DefaultTask {
277279
BlogTask.MMMM_D_YYYY.format(BlogTask.parseDate(date))
278280
}
279281

282+
@CompileDynamic
283+
static String formatDateMinus6Months(String date) {
284+
use(TimeCategory) {
285+
BlogTask.MMMM_D_YYYY.format(BlogTask.parseDate(date) - 6.months)
286+
}
287+
}
288+
289+
static String URLEncode(String date) {
290+
URLEncoder.encode(date, "UTF-8")
291+
}
292+
280293
static String replaceLineWithMetadata(String line, Map<String, String> metadata) {
281294
Map<String, String> m = new HashMap<>(metadata)
282295
if (m.containsKey('date')) {
283296
m['date'] = formatDate(m['date'])
297+
m['6MonthsBackForGitHub'] = '?from=' + URLEncode(formatDateMinus6Months(m['date'])) + '&to=' + URLEncode(formatDate(m['date']))
284298
}
285299
for (String metadataKey : m.keySet()) {
286300
if (line.contains("[%${metadataKey}]".toString())) {

posts/2025-07-15-grails-7-m5.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
version: 7.0.0-M5
33
priorVersion: 7.0.0-M4
44
title: Apache Grails (Incubating) [%version] - Release Announcement
5-
3MonthsBackForGitHub: 4/15/2025
65
date: June 15, 2025
76
description: The Apache Grails (incubating) community is excited to announce the Milestone [%version] release of the Grails Framework!
87
author: James Fredley
@@ -235,14 +234,14 @@ Special thanks to:
235234
236235
Recent Contributors by Project:
237236
238-
* [grails-core](https://github.com/apache/grails-core/graphs/contributors?from=[%3MonthsBackForGitHub])
239-
* [grails-spring-security](https://github.com/apache/grails-spring-security/graphs/contributors?from=[%3MonthsBackForGitHub])
240-
* [grails-static-website](https://github.com/apache/grails-static-website/graphs/contributors?from=[%3MonthsBackForGitHub])
241-
* [grails-forge-ui](https://github.com/apache/grails-forge-ui/graphs/contributors?from=[%3MonthsBackForGitHub])
242-
* [grails-quartz](https://github.com/apache/grails-quartz/graphs/contributors?from=[%3MonthsBackForGitHub])
243-
* [grails-gradle-publish](https://github.com/apache/incubator-grails-gradle-publish/graphs/contributors?from=[%3MonthsBackForGitHub])
244-
* [grails-redis](https://github.com/apache/grails-redis/graphs/contributors?from=[%3MonthsBackForGitHub])
245-
* [grails-github-actions](https://github.com/apache/grails-github-actions/graphs/contributors?from=[%3MonthsBackForGitHub])
237+
* [grails-core](https://github.com/apache/grails-core/graphs/contributors[%6MonthsBackForGitHub])
238+
* [grails-spring-security](https://github.com/apache/grails-spring-security/graphs/contributors[%6MonthsBackForGitHub])
239+
* [grails-static-website](https://github.com/apache/grails-static-website/graphs/contributors[%6MonthsBackForGitHub])
240+
* [grails-forge-ui](https://github.com/apache/grails-forge-ui/graphs/contributors[%6MonthsBackForGitHub])
241+
* [grails-quartz](https://github.com/apache/grails-quartz/graphs/contributors[%6MonthsBackForGitHub])
242+
* [grails-gradle-publish](https://github.com/apache/incubator-grails-gradle-publish/graphs/contributors[%6MonthsBackForGitHub])
243+
* [grails-redis](https://github.com/apache/grails-redis/graphs/contributors[%6MonthsBackForGitHub])
244+
* [grails-github-actions](https://github.com/apache/grails-github-actions/graphs/contributors[%6MonthsBackForGitHub])
246245
247246
[Combined Commit List](https://github.com/search?q=repo%3Aapache%2Fgrails-core+repo%3Aapache%2Fgrails-spring-security+repo%3Aapache%2Fgrails-static-website+repo%3Aapache%2Fgrails-forge-ui+repo%3Aapache%2Fgrails-quartz+repo%3Aapache%2Fincubator-grails-gradle-publish+repo%3Agrails-redis+repo%3Agrails-github-actions+is%3Apublic&type=commits&s=committer-date&o=desc)
248247

0 commit comments

Comments
 (0)