fix: dont show PostManagementCommits
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m26s

This commit is contained in:
svemagie
2026-04-02 09:10:20 +02:00
parent dfaaa76509
commit 8dc202bbc9
3 changed files with 16 additions and 4 deletions

View File

@@ -14,6 +14,12 @@ function truncate(text, maxLength = 80) {
return text.slice(0, maxLength - 1) + "..."; return text.slice(0, maxLength - 1) + "...";
} }
const POST_MANAGEMENT_RE = /^(create|update|delete)\s+\w+\s+post$/i;
function isPostManagementCommit(msg) {
return POST_MANAGEMENT_RE.test((msg || "").trim());
}
async function fetchGiteaCommits() { async function fetchGiteaCommits() {
const allCommits = []; const allCommits = [];
@@ -25,6 +31,7 @@ async function fetchGiteaCommits() {
for (const c of Array.isArray(commits) ? commits : []) { for (const c of Array.isArray(commits) ? commits : []) {
const msg = (c.commit?.message || "").split("\n")[0]; const msg = (c.commit?.message || "").split("\n")[0];
if (isPostManagementCommit(msg)) continue;
allCommits.push({ allCommits.push({
sha: c.sha.slice(0, 7), sha: c.sha.slice(0, 7),
message: truncate(msg), message: truncate(msg),

View File

@@ -108,6 +108,12 @@ const GITEA_URL = '{{ site.gitea.url }}';
const GITEA_ORG = '{{ site.gitea.org }}'; const GITEA_ORG = '{{ site.gitea.org }}';
const GITEA_REPOS = {{ site.gitea.repos | dump | safe }}; const GITEA_REPOS = {{ site.gitea.repos | dump | safe }};
const POST_MANAGEMENT_RE = /^(create|update|delete)\s+\w+\s+post$/i;
function isPostManagementCommit(msg) {
return POST_MANAGEMENT_RE.test((msg || '').trim());
}
function categorizeCommit(message) { function categorizeCommit(message) {
const lower = (message || '').toLowerCase(); const lower = (message || '').toLowerCase();
if (/^feat(\(.+\))?!?:/.test(lower)) return 'features'; if (/^feat(\(.+\))?!?:/.test(lower)) return 'features';
@@ -177,6 +183,7 @@ function changelogApp() {
for (const c of commits) { for (const c of commits) {
const lines = (c.commit?.message || '').split('\n'); const lines = (c.commit?.message || '').split('\n');
const title = lines[0]; const title = lines[0];
if (isPostManagementCommit(title)) continue;
const body = lines.slice(1).join('\n').trim(); const body = lines.slice(1).join('\n').trim();
newCommits.push({ newCommits.push({
sha: c.sha.slice(0, 7), sha: c.sha.slice(0, 7),

View File

@@ -9,9 +9,6 @@ withSidebar: true
<h1 class="text-2xl sm:text-3xl font-bold text-surface-900 dark:text-surface-100 mb-2">GitHub Activity</h1> <h1 class="text-2xl sm:text-3xl font-bold text-surface-900 dark:text-surface-100 mb-2">GitHub Activity</h1>
<p class="text-surface-600 dark:text-surface-400"> <p class="text-surface-600 dark:text-surface-400">
My open source contributions and starred repositories. My open source contributions and starred repositories.
<a href="https://github.com/{{ site.feeds.github }}" class="text-emerald-600 dark:text-emerald-400 hover:underline" target="_blank" rel="noopener">
Follow me on GitHub
</a>
</p> </p>
</header> </header>
@@ -203,9 +200,10 @@ withSidebar: true
{% endfor %} {% endfor %}
</div> </div>
<a href="https://github.com/{{ site.feeds.github }}?tab=repositories" class="inline-block mt-4 text-emerald-600 dark:text-emerald-400 hover:underline"> {# <a href="https://github.com/{{ site.feeds.github }}?tab=repositories" class="inline-block mt-4 text-emerald-600 dark:text-emerald-400 hover:underline">
View all repositories &rarr; View all repositories &rarr;
</a> </a>
#}
{% else %} {% else %}
<p class="text-surface-600 dark:text-surface-400">No repositories found.</p> <p class="text-surface-600 dark:text-surface-400">No repositories found.</p>
{% endif %} {% endif %}