From 4f470ac51443922aa94a58a896286a0115612d00 Mon Sep 17 00:00:00 2001 From: Piotr Krzeminski Date: Fri, 8 Nov 2024 08:38:20 +0100 Subject: [PATCH 1/5] Open log diff after clicking on 'To upstream' badge --- .github/workflows/check-upstream.main.kts | 13 ++++++++++--- .github/workflows/check-upstream.yaml | 11 ++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-upstream.main.kts b/.github/workflows/check-upstream.main.kts index 1734a01b7..04ac95dfd 100755 --- a/.github/workflows/check-upstream.main.kts +++ b/.github/workflows/check-upstream.main.kts @@ -14,6 +14,7 @@ import io.github.typesafegithub.workflows.domain.triggers.WorkflowDispatch import io.github.typesafegithub.workflows.dsl.workflow val numberOfCommitsFileName = "number-of-commits.txt" +val logDiffBetweenRepos = "log-diff-between-repos.txt" val badgeFileName = "commits-to-upstream-badge.svg" workflow( @@ -36,7 +37,8 @@ workflow( git clone --branch master --single-branch https://bitbucket.org/snakeyaml/snakeyaml-engine.git wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${'$'}{{ github.ref }}/upstream-commit.txt cd snakeyaml-engine - git log --oneline $(cat ../upstream-commit.txt)..master | wc -l > ../$numberOfCommitsFileName + git log --oneline ${'$'}(cat ../upstream-commit.txt)..master > ../$logDiffBetweenRepos + cat $logDiffBetweenRepos | wc -l > ../$numberOfCommitsFileName """.trimIndent(), ) run( @@ -48,13 +50,18 @@ workflow( command = "cat $badgeFileName", ) run( - name = "Commit updated badge", + name = "Preview log diff", + command = "cat $logDiffBetweenRepos", + ) + run( + name = "Commit updated badge and log diff", command = """ git config --global user.email "<>" git config --global user.name "GitHub Actions Bot" git add $badgeFileName - git commit --allow-empty -m "Regenerate badge" + git add $logDiffBetweenRepos + git commit --allow-empty -m "Regenerate badge and log diff" git push """.trimIndent() ) diff --git a/.github/workflows/check-upstream.yaml b/.github/workflows/check-upstream.yaml index b43426275..d378fc472 100644 --- a/.github/workflows/check-upstream.yaml +++ b/.github/workflows/check-upstream.yaml @@ -39,7 +39,8 @@ jobs: git clone --branch master --single-branch https://bitbucket.org/snakeyaml/snakeyaml-engine.git wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${{ github.ref }}/upstream-commit.txt cd snakeyaml-engine - git log --oneline $(cat ../upstream-commit.txt)..master | wc -l > ../number-of-commits.txt + git log --oneline $(cat ../upstream-commit.txt)..master > ../log-diff-between-repos.txt + cat log-diff-between-repos.txt | wc -l > ../number-of-commits.txt - id: 'step-2' name: 'Create an SVG with the number of commits' run: 'wget -O commits-to-upstream-badge.svg https://img.shields.io/badge/To%20upstream-$(cat number-of-commits.txt)-blue' @@ -47,11 +48,15 @@ jobs: name: 'Preview badge' run: 'cat commits-to-upstream-badge.svg' - id: 'step-4' - name: 'Commit updated badge' + name: 'Preview log diff' + run: 'cat log-diff-between-repos.txt' + - id: 'step-5' + name: 'Commit updated badge and log diff' run: |- git config --global user.email "<>" git config --global user.name "GitHub Actions Bot" git add commits-to-upstream-badge.svg - git commit --allow-empty -m "Regenerate badge" + git add log-diff-between-repos.txt + git commit --allow-empty -m "Regenerate badge and log diff" git push From 66ea47792b9f5ee816fdb3445e23dfd278aa69c3 Mon Sep 17 00:00:00 2001 From: Piotr Krzeminski Date: Fri, 8 Nov 2024 08:41:08 +0100 Subject: [PATCH 2/5] Fix counter and add link --- .github/workflows/check-upstream.main.kts | 2 +- .github/workflows/check-upstream.yaml | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-upstream.main.kts b/.github/workflows/check-upstream.main.kts index 04ac95dfd..c02713c61 100755 --- a/.github/workflows/check-upstream.main.kts +++ b/.github/workflows/check-upstream.main.kts @@ -38,7 +38,7 @@ workflow( wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${'$'}{{ github.ref }}/upstream-commit.txt cd snakeyaml-engine git log --oneline ${'$'}(cat ../upstream-commit.txt)..master > ../$logDiffBetweenRepos - cat $logDiffBetweenRepos | wc -l > ../$numberOfCommitsFileName + cat ../$logDiffBetweenRepos | wc -l > ../$numberOfCommitsFileName """.trimIndent(), ) run( diff --git a/.github/workflows/check-upstream.yaml b/.github/workflows/check-upstream.yaml index d378fc472..58bc908b6 100644 --- a/.github/workflows/check-upstream.yaml +++ b/.github/workflows/check-upstream.yaml @@ -40,7 +40,7 @@ jobs: wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${{ github.ref }}/upstream-commit.txt cd snakeyaml-engine git log --oneline $(cat ../upstream-commit.txt)..master > ../log-diff-between-repos.txt - cat log-diff-between-repos.txt | wc -l > ../number-of-commits.txt + cat ../log-diff-between-repos.txt | wc -l > ../number-of-commits.txt - id: 'step-2' name: 'Create an SVG with the number of commits' run: 'wget -O commits-to-upstream-badge.svg https://img.shields.io/badge/To%20upstream-$(cat number-of-commits.txt)-blue' diff --git a/README.md b/README.md index 448a75680..b0c324cbf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Maven Central Version](https://maven-badges.herokuapp.com/maven-central/it.krzeminski/snakeyaml-engine-kmp/badge.svg)](https://maven-badges.herokuapp.com/maven-central/it.krzeminski/snakeyaml-engine-kmp) -![Commits to upstream](https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/refs/heads/commits-to-upstream-badge/commits-to-upstream-badge.svg) +[![Commits to upstream](https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/refs/heads/commits-to-upstream-badge/commits-to-upstream-badge.svg)](https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/refs/heads/commits-to-upstream-badge/log-diff-between-repos.txt) # SnakeYAML Engine KMP From 1a4aa28c17caa39b907cdc5a1622e3e7ecc0434a Mon Sep 17 00:00:00 2001 From: Piotr Krzeminski Date: Fri, 8 Nov 2024 11:35:11 +0100 Subject: [PATCH 3/5] Put link to BitBucket at the beginning --- .github/workflows/check-upstream.main.kts | 5 ++++- .github/workflows/check-upstream.yaml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-upstream.main.kts b/.github/workflows/check-upstream.main.kts index c02713c61..f968869ed 100755 --- a/.github/workflows/check-upstream.main.kts +++ b/.github/workflows/check-upstream.main.kts @@ -37,7 +37,10 @@ workflow( git clone --branch master --single-branch https://bitbucket.org/snakeyaml/snakeyaml-engine.git wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${'$'}{{ github.ref }}/upstream-commit.txt cd snakeyaml-engine - git log --oneline ${'$'}(cat ../upstream-commit.txt)..master > ../$logDiffBetweenRepos + UPSTREAM_COMMIT=$(cat ../upstream-commit.txt) + echo "See in BitBucket: https://bitbucket.org/snakeyaml/snakeyaml-engine/branches/compare/master..${'$'}UPSTREAM_COMMIT" > ../$logDiffBetweenRepos + echo "" >> ../$logDiffBetweenRepos + git log --oneline ${'$'}UPSTREAM_COMMIT..master >> ../$logDiffBetweenRepos cat ../$logDiffBetweenRepos | wc -l > ../$numberOfCommitsFileName """.trimIndent(), ) diff --git a/.github/workflows/check-upstream.yaml b/.github/workflows/check-upstream.yaml index 58bc908b6..4c9fddef4 100644 --- a/.github/workflows/check-upstream.yaml +++ b/.github/workflows/check-upstream.yaml @@ -39,7 +39,10 @@ jobs: git clone --branch master --single-branch https://bitbucket.org/snakeyaml/snakeyaml-engine.git wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${{ github.ref }}/upstream-commit.txt cd snakeyaml-engine - git log --oneline $(cat ../upstream-commit.txt)..master > ../log-diff-between-repos.txt + UPSTREAM_COMMIT=$(cat ../upstream-commit.txt) + echo "See in BitBucket: https://bitbucket.org/snakeyaml/snakeyaml-engine/branches/compare/master..$UPSTREAM_COMMIT" > ../log-diff-between-repos.txt + echo "" >> ../log-diff-between-repos.txt + git log --oneline $UPSTREAM_COMMIT..master >> ../log-diff-between-repos.txt cat ../log-diff-between-repos.txt | wc -l > ../number-of-commits.txt - id: 'step-2' name: 'Create an SVG with the number of commits' From e328af3d31b40d5613def165930c13a2daf3365d Mon Sep 17 00:00:00 2001 From: Piotr Krzeminski Date: Fri, 8 Nov 2024 11:52:02 +0100 Subject: [PATCH 4/5] Fix incorrectly calculated lines --- .github/workflows/check-upstream.main.kts | 5 +++-- .github/workflows/check-upstream.yaml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-upstream.main.kts b/.github/workflows/check-upstream.main.kts index f968869ed..a3a75f5fb 100755 --- a/.github/workflows/check-upstream.main.kts +++ b/.github/workflows/check-upstream.main.kts @@ -38,10 +38,11 @@ workflow( wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${'$'}{{ github.ref }}/upstream-commit.txt cd snakeyaml-engine UPSTREAM_COMMIT=$(cat ../upstream-commit.txt) + DIFF_CONTENT=$(git log --oneline ${'$'}UPSTREAM_COMMIT..master) echo "See in BitBucket: https://bitbucket.org/snakeyaml/snakeyaml-engine/branches/compare/master..${'$'}UPSTREAM_COMMIT" > ../$logDiffBetweenRepos echo "" >> ../$logDiffBetweenRepos - git log --oneline ${'$'}UPSTREAM_COMMIT..master >> ../$logDiffBetweenRepos - cat ../$logDiffBetweenRepos | wc -l > ../$numberOfCommitsFileName + echo ${'$'}DIFF_CONTENT >> ../$logDiffBetweenRepos + echo ${'$'}DIFF_CONTENT | wc -l > ../$numberOfCommitsFileName """.trimIndent(), ) run( diff --git a/.github/workflows/check-upstream.yaml b/.github/workflows/check-upstream.yaml index 4c9fddef4..94f7db8c7 100644 --- a/.github/workflows/check-upstream.yaml +++ b/.github/workflows/check-upstream.yaml @@ -40,10 +40,11 @@ jobs: wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${{ github.ref }}/upstream-commit.txt cd snakeyaml-engine UPSTREAM_COMMIT=$(cat ../upstream-commit.txt) + DIFF_CONTENT=$(git log --oneline $UPSTREAM_COMMIT..master) echo "See in BitBucket: https://bitbucket.org/snakeyaml/snakeyaml-engine/branches/compare/master..$UPSTREAM_COMMIT" > ../log-diff-between-repos.txt echo "" >> ../log-diff-between-repos.txt - git log --oneline $UPSTREAM_COMMIT..master >> ../log-diff-between-repos.txt - cat ../log-diff-between-repos.txt | wc -l > ../number-of-commits.txt + echo $DIFF_CONTENT >> ../log-diff-between-repos.txt + echo $DIFF_CONTENT | wc -l > ../number-of-commits.txt - id: 'step-2' name: 'Create an SVG with the number of commits' run: 'wget -O commits-to-upstream-badge.svg https://img.shields.io/badge/To%20upstream-$(cat number-of-commits.txt)-blue' From 24e00bea0e641366d8194bf6b2721e8aaf2ee905 Mon Sep 17 00:00:00 2001 From: Piotr Krzeminski Date: Fri, 8 Nov 2024 11:55:05 +0100 Subject: [PATCH 5/5] yet another fix --- .github/workflows/check-upstream.main.kts | 5 ++--- .github/workflows/check-upstream.yaml | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-upstream.main.kts b/.github/workflows/check-upstream.main.kts index a3a75f5fb..f8aa74ce2 100755 --- a/.github/workflows/check-upstream.main.kts +++ b/.github/workflows/check-upstream.main.kts @@ -38,11 +38,10 @@ workflow( wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${'$'}{{ github.ref }}/upstream-commit.txt cd snakeyaml-engine UPSTREAM_COMMIT=$(cat ../upstream-commit.txt) - DIFF_CONTENT=$(git log --oneline ${'$'}UPSTREAM_COMMIT..master) echo "See in BitBucket: https://bitbucket.org/snakeyaml/snakeyaml-engine/branches/compare/master..${'$'}UPSTREAM_COMMIT" > ../$logDiffBetweenRepos echo "" >> ../$logDiffBetweenRepos - echo ${'$'}DIFF_CONTENT >> ../$logDiffBetweenRepos - echo ${'$'}DIFF_CONTENT | wc -l > ../$numberOfCommitsFileName + git log --oneline ${'$'}UPSTREAM_COMMIT..master >> ../$logDiffBetweenRepos + git log --oneline ${'$'}UPSTREAM_COMMIT..master | wc -l > ../$numberOfCommitsFileName """.trimIndent(), ) run( diff --git a/.github/workflows/check-upstream.yaml b/.github/workflows/check-upstream.yaml index 94f7db8c7..d91a4a91a 100644 --- a/.github/workflows/check-upstream.yaml +++ b/.github/workflows/check-upstream.yaml @@ -40,11 +40,10 @@ jobs: wget https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/${{ github.ref }}/upstream-commit.txt cd snakeyaml-engine UPSTREAM_COMMIT=$(cat ../upstream-commit.txt) - DIFF_CONTENT=$(git log --oneline $UPSTREAM_COMMIT..master) echo "See in BitBucket: https://bitbucket.org/snakeyaml/snakeyaml-engine/branches/compare/master..$UPSTREAM_COMMIT" > ../log-diff-between-repos.txt echo "" >> ../log-diff-between-repos.txt - echo $DIFF_CONTENT >> ../log-diff-between-repos.txt - echo $DIFF_CONTENT | wc -l > ../number-of-commits.txt + git log --oneline $UPSTREAM_COMMIT..master >> ../log-diff-between-repos.txt + git log --oneline $UPSTREAM_COMMIT..master | wc -l > ../number-of-commits.txt - id: 'step-2' name: 'Create an SVG with the number of commits' run: 'wget -O commits-to-upstream-badge.svg https://img.shields.io/badge/To%20upstream-$(cat number-of-commits.txt)-blue'