Skip to content
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

Implement logic of check-upstream #262

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/check-upstream.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@ workflow(
) {
uses(action = Checkout())
run(
name = "Clone snakeyaml-engine",
command = "git clone https://bitbucket.org/snakeyaml/snakeyaml-engine.git && cd snakeyaml-engine"
name = "Clone snakeyaml-engine and check for changes",
command = """
git clone --branch master --single-branch https://bitbucket.org/snakeyaml/snakeyaml-engine.git
cd snakeyaml-engine
git log --oneline $(cat ../upstream-commit.txt)..master | wc -l > ../number-of-commits.txt
""".trimIndent(),
)
run(
name = "Calculate changes between the last synced change and current state",
// TODO: store this commit hash in a file
// TODO: get the numerical value (| wc -l)
command = "git log --oneline ef7ebe9c06e963e13f4ab465f300a0dd6f0940c9..master"
name = "Create an SVG with the number of commits",
command = """
echo "<svg viewBox=\"0 0 85 20\" xmlns=\"http://www.w3.org/2000/svg\"><style>.number { font: 13px sans-serif; }</style><text x=\"0\" y=\"0\" class=\"number\">${'$'}(cat number-of-commits.txt)</text></svg>" > badge.svg
""".trimIndent(),
)
run(
name = "Preview badge",
command = "cat badge.svg",
)
}
}
14 changes: 10 additions & 4 deletions .github/workflows/check-upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ jobs:
- id: 'step-0'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Clone snakeyaml-engine'
run: 'git clone https://bitbucket.org/snakeyaml/snakeyaml-engine.git && cd snakeyaml-engine'
name: 'Clone snakeyaml-engine and check for changes'
run: |-
git clone --branch master --single-branch https://bitbucket.org/snakeyaml/snakeyaml-engine.git
cd snakeyaml-engine
git log --oneline $(cat ../upstream-commit.txt)..master | wc -l > ../number-of-commits.txt
- id: 'step-2'
name: 'Calculate changes between the last synced change and current state'
run: 'git log --oneline ef7ebe9c06e963e13f4ab465f300a0dd6f0940c9..master'
name: 'Create an SVG with the number of commits'
run: 'echo "<svg viewBox=\"0 0 85 20\" xmlns=\"http://www.w3.org/2000/svg\"><style>.number { font: 13px sans-serif; }</style><text x=\"0\" y=\"0\" class=\"number\">$(cat number-of-commits.txt)</text></svg>" > badge.svg'
- id: 'step-3'
name: 'Preview badge'
run: 'cat badge.svg'
1 change: 1 addition & 0 deletions upstream-commit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ef7ebe9c06e963e13f4ab465f300a0dd6f0940c9