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

Comment on alert only if the PR is made from main repo #250

Merged
merged 2 commits into from
Oct 3, 2024
Merged
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
9 changes: 6 additions & 3 deletions .github/workflows/benchmark.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ val BENCHMARK_RESULTS = "snake-kmp-benchmarks/build/reports/benchmarks"
val RESULTS_DIR = "bench-results"
val AGGREGATED_REPORT = "aggregated.json"
val PUBLISH_BENCHMARK_RESULTS by Contexts.secrets
val FULL_REPOSITORY_NAME = "krzema12/snakeyaml-engine-kmp"

workflow(
name = "Run Benchmarks",
Expand Down Expand Up @@ -144,15 +145,17 @@ workflow(
action = GithubActionBenchmark(
name = "SnakeKMP benchmarks",
tool = GithubActionBenchmark.Tool.Jmh,
commentOnAlert = true,
// Comment on PR only the PR is made from the same repo
commentOnAlert_Untyped = expr { "${github.eventPullRequest.pull_request.head.repo.full_name} == '$FULL_REPOSITORY_NAME'" },
summaryAlways = true,
alertThreshold = "150%",
failThreshold = "200%",
ghRepository = "github.com/krzema12/snakeyaml-engine-kmp-benchmarks",
outputFilePath = AGGREGATED_REPORT,
githubToken = expr { PUBLISH_BENCHMARK_RESULTS },
// Use GitHub token in case the secret is not available
githubToken = expr { "$PUBLISH_BENCHMARK_RESULTS || ${github.token}" },
// Push and deploy GitHub pages branch automatically only if run in main repo and not in PR
autoPush_Untyped = expr { "${github.repository} == 'krzema12/snakeyaml-engine-kmp' && ${github.event_name} != 'pull_request'" },
autoPush_Untyped = expr { "${github.repository} == '$FULL_REPOSITORY_NAME' && ${github.event_name} != 'pull_request'" },
),
)
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ jobs:
tool: 'jmh'
output-file-path: 'aggregated.json'
gh-repository: 'github.com/krzema12/snakeyaml-engine-kmp-benchmarks'
github-token: '${{ secrets.PUBLISH_BENCHMARK_RESULTS }}'
github-token: '${{ secrets.PUBLISH_BENCHMARK_RESULTS || github.token }}'
auto-push: '${{ github.repository == ''krzema12/snakeyaml-engine-kmp'' && github.event_name != ''pull_request'' }}'
summary-always: 'true'
comment-on-alert: 'true'
comment-on-alert: '${{ github.event.pull_request.head.repo.full_name == ''krzema12/snakeyaml-engine-kmp'' }}'
alert-threshold: '150%'
fail-threshold: '200%'
Loading