duel-rails 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -1
- data/README.md +1 -1
- data/lib/duel/rails/version.rb +1 -1
- data/lib/generators/duel/install/install_generator.rb +33 -0
- data/lib/generators/duel/install/templates/duel.rb.tt +7 -3
- data/lib/generators/duel/install/templates/perf-comment.yml.tt +19 -3
- data/lib/generators/duel/install/templates/perf.yml.tt +65 -5
- data/sig/duel/rails.rbs +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c9e748bfafe8fa99ec68348af035b11eff2acb55667d4a19673c28434879052
|
|
4
|
+
data.tar.gz: 3332736f9955c3718117a75561ab7cf54cbaf80513d3c4e8590d0bfe5d224c9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd47a29c4976ec55ec33c7cfb70bc86c9b5673bbfaf445db9eaa06ee6d76a7aa17203dee610f059fd1f3e239a9250868d919ae44358ebafa7475f81484985986
|
|
7
|
+
data.tar.gz: 589eb2468415a54e669772293e1b0727904e44e0a6318e7a0ab529d2237a797f8cac981d1f221746a240e50ff31451ae4b698c1ac92a5323a88cd7a038b643a4
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.5] - 2026-11-08
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `rails generate duel:install` writes the Comment on the commit and
|
|
15
|
+
Mark the commit passed jobs only where `.duel.rb` asks for them, as
|
|
16
|
+
`duel init` does.
|
|
17
|
+
- `rails generate duel:install` writes the Update the badge job only
|
|
18
|
+
with `--badge`, as `duel init` does, so the workflow it writes by
|
|
19
|
+
default only reads.
|
|
20
|
+
- The `.duel.rb` that `rails generate duel:install` writes sets
|
|
21
|
+
`c.accept_label = "duel: accept"`, as `duel init`'s does.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- The Perf comment workflow that `rails generate duel:install` writes
|
|
26
|
+
shows a fork's report as text, in a code block, as the workflow that
|
|
27
|
+
`duel init` writes does.
|
|
28
|
+
- The Update the badge job, in the workflow that
|
|
29
|
+
`rails generate duel:install` writes, now writes the badge's image
|
|
30
|
+
itself instead of downloading it from Duel's repository.
|
|
31
|
+
- Two pushes' runs of the Update the badge job, in the workflow that
|
|
32
|
+
`rails generate duel:install` writes, could overlap, and an older
|
|
33
|
+
push's could write its badge over a newer one's. The job now runs
|
|
34
|
+
one at a time, as in the workflow that `duel init` writes.
|
|
35
|
+
|
|
10
36
|
## [0.1.4] - 2026-11-06
|
|
11
37
|
|
|
12
38
|
### Fixed
|
|
@@ -206,7 +232,8 @@ Rails 7.2 or later, and Ruby 3.4 or later.
|
|
|
206
232
|
CI.
|
|
207
233
|
- RBS signatures in sig/, checked with Steep.
|
|
208
234
|
|
|
209
|
-
[Unreleased]: https://github.com/sferik/duel-ruby/compare/duel-rails-v0.1.
|
|
235
|
+
[Unreleased]: https://github.com/sferik/duel-ruby/compare/duel-rails-v0.1.5...HEAD
|
|
236
|
+
[0.1.5]: https://github.com/sferik/duel-ruby/compare/duel-rails-v0.1.4...duel-rails-v0.1.5
|
|
210
237
|
[0.1.4]: https://github.com/sferik/duel-ruby/compare/duel-rails-v0.1.3...duel-rails-v0.1.4
|
|
211
238
|
[0.1.3]: https://github.com/sferik/duel-ruby/compare/duel-rails-v0.1.2...duel-rails-v0.1.3
|
|
212
239
|
[0.1.2]: https://github.com/sferik/duel-ruby/compare/duel-rails-v0.1.1...duel-rails-v0.1.2
|
data/README.md
CHANGED
|
@@ -68,7 +68,7 @@ production does, with everything of its own:
|
|
|
68
68
|
| `config/environments/benchmark.rb` | The environment that each version boots in, based on production. |
|
|
69
69
|
| `duel/requests_duel.rb` | A benchmark of each of your app's first 10 routes that a GET reaches without parameters. |
|
|
70
70
|
| `duel/boot_duel.rb` | A benchmark of your app's boot. See [Benchmark your app's boot](#benchmark-your-apps-boot). |
|
|
71
|
-
| `.github/workflows/perf.yml` | A GitHub Actions workflow that runs Duel on pull requests, on pushes to `main`, and nightly against your last release, and has the second workflow comment on a pull request with Duel's report when a benchmark fails. It never edits a comment, and after a failure, posts one more when a run passes. To comment on every run, or never, set `c.comment` in `.duel.rb`: see [Choose when to comment on a pull request](https://github.com/sferik/duel-ruby/blob/main/docs/configuration.md#choose-when-to-comment-on-a-pull-request) and [Report on a pull request](https://github.com/sferik/duel-ruby#report-on-a-pull-request). For an app in a subdirectory of its repository, the workflow is at the repository's root. See [An app in a monorepo](#an-app-in-a-monorepo). |
|
|
71
|
+
| `.github/workflows/perf.yml` | A GitHub Actions workflow that runs Duel on pull requests, on pushes to `main`, and nightly against your last release, and has the second workflow comment on a pull request with Duel's report when a benchmark fails. It never edits a comment, and after a failure, posts one more when a run passes. To comment on every run, or never, set `c.comment` in `.duel.rb`: see [Choose when to comment on a pull request](https://github.com/sferik/duel-ruby/blob/main/docs/configuration.md#choose-when-to-comment-on-a-pull-request) and [Report on a pull request](https://github.com/sferik/duel-ruby#report-on-a-pull-request). For an app in a subdirectory of its repository, the workflow is at the repository's root. See [An app in a monorepo](#an-app-in-a-monorepo). With `--badge`, it also keeps a badge for your README that turns red when Duel fails a push (see [Show whether the last push passed](https://github.com/sferik/duel-ruby/blob/main/docs/ci.md#show-whether-the-last-push-passed)). |
|
|
72
72
|
| `.github/workflows/perf-comment.yml` | A second workflow, which comments on a pull request with the report once the first has run, with a token that can write, so a pull request from a fork gets a comment too. It runs none of the pull request's code. See [Comment on a pull request](https://github.com/sferik/duel-ruby/blob/main/docs/ci.md#comment-on-a-pull-request). |
|
|
73
73
|
|
|
74
74
|
The generator also adds `gem "stackprof", platforms: :mri` to your
|
data/lib/duel/rails/version.rb
CHANGED
|
@@ -20,6 +20,8 @@ module Duel
|
|
|
20
20
|
|
|
21
21
|
class_option :database, type: :string, enum: %w[sqlite postgresql mysql2 trilogy],
|
|
22
22
|
desc: "Each worker's database (default: as the app's own)"
|
|
23
|
+
class_option :badge, type: :boolean, default: false,
|
|
24
|
+
desc: "Write a job that keeps a badge for the README (it needs contents: write)"
|
|
23
25
|
|
|
24
26
|
# The adapters each worker's database can stand in for, by the
|
|
25
27
|
# database duel-rails calls it.
|
|
@@ -69,6 +71,37 @@ module Duel
|
|
|
69
71
|
|
|
70
72
|
private
|
|
71
73
|
|
|
74
|
+
# The app's settings, which decide the workflow's jobs, as for
|
|
75
|
+
# `duel init` (see Duel::Init#settings): its .duel.rb's, which
|
|
76
|
+
# create_config has written by now (or kept), or nil where it doesn't
|
|
77
|
+
# load, and then the workflow has both jobs for pushes, and says so.
|
|
78
|
+
def settings = instance_variable_defined?(:@settings) ? @settings : (@settings = load_settings)
|
|
79
|
+
|
|
80
|
+
def load_settings
|
|
81
|
+
Duel.load_config(File.join(destination_root, ".duel.rb"))
|
|
82
|
+
rescue ScriptError, StandardError => e
|
|
83
|
+
say_status :warning, ".duel.rb didn't load (#{e.class}: #{e}), so the workflow has both jobs for pushes, as if it asked for them"
|
|
84
|
+
nil
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Whether the workflow comments on a pushed commit: where a regression
|
|
88
|
+
# in a push passes (c.fail_on = :pull_requests).
|
|
89
|
+
def comment_on_pushes?
|
|
90
|
+
found = settings
|
|
91
|
+
found.nil? || found.fail_on == :pull_requests
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Whether the workflow marks a push passed: where a push is compared
|
|
95
|
+
# with the last commit Duel passed (c.push_base = :last_passed).
|
|
96
|
+
def mark_passed?
|
|
97
|
+
found = settings
|
|
98
|
+
found.nil? || found.push_base == :last_passed
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Whether the workflow keeps a badge for the README (--badge), as for
|
|
102
|
+
# `duel init` (see Duel::Init#badge?).
|
|
103
|
+
def badge? = options.fetch(:badge)
|
|
104
|
+
|
|
72
105
|
def gemfile = File.read(File.join(destination_root, "Gemfile"))
|
|
73
106
|
|
|
74
107
|
# The database each worker gets: as asked, or as the app's own
|
|
@@ -28,14 +28,18 @@ Duel.configure do |c|
|
|
|
28
28
|
|
|
29
29
|
# Which runs a regression fails: :every_run, or :pull_requests, for a
|
|
30
30
|
# project where people push to main directly (on GitHub Actions, another
|
|
31
|
-
# run warns and passes, and a pushed commit gets the comment instead
|
|
31
|
+
# run warns and passes, and a pushed commit gets the comment instead,
|
|
32
|
+
# from a workflow job written only where this is set: see docs/ci.md).
|
|
32
33
|
# c.fail_on = :every_run
|
|
33
34
|
|
|
34
|
-
# A label that accepts a regression in a pull request
|
|
35
|
-
#
|
|
35
|
+
# A label that accepts a regression in a pull request, for a change
|
|
36
|
+
# that's slower on purpose (nil for none).
|
|
37
|
+
c.accept_label = "duel: accept"
|
|
36
38
|
|
|
37
39
|
# What the workflow compares a push with: :before (the commit before it),
|
|
38
40
|
# or :last_passed (the last commit Duel passed, which a branch,
|
|
39
41
|
# duel/passed/main, marks), so small slowdowns add up until they fail.
|
|
42
|
+
# (A workflow job moves the branch, written only where this is set: see
|
|
43
|
+
# docs/ci.md.)
|
|
40
44
|
# c.push_base = :before
|
|
41
45
|
end
|
|
@@ -9,7 +9,8 @@ name: Perf comment<%= " (#{working_directory})" if working_directory %>
|
|
|
9
9
|
# the pull request's code, and of what the Duel job kept (where that code
|
|
10
10
|
# ran), it trusts only what that job could have said: the pull request's
|
|
11
11
|
# number, if it names the pull request the run compared, and the comment
|
|
12
|
-
# and the status, if they're ones Duel says.
|
|
12
|
+
# and the status, if they're ones Duel says. A fork's report, which the
|
|
13
|
+
# fork's code wrote, is shown as text. (The workflow must be on the
|
|
13
14
|
# default branch before it runs at all.)
|
|
14
15
|
on:
|
|
15
16
|
workflow_run:
|
|
@@ -47,13 +48,28 @@ jobs:
|
|
|
47
48
|
COMMENT=$(said comment 'post|change')
|
|
48
49
|
STATUS=$(said status 'passed|failed|neutral')
|
|
49
50
|
[ -n "$PR" ] && [ -n "$COMMENT" ] && [ -n "$STATUS" ] || exit 0
|
|
50
|
-
|
|
51
|
+
# (The pull request's head commit, and the repository it's from.)
|
|
52
|
+
head=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR" --jq '"\(.head.sha) \(.head.repo.full_name)"')
|
|
53
|
+
[ "${head%% *}" = "$HEAD_SHA" ] || exit 0
|
|
54
|
+
# The report, as Markdown for a branch of this repository (whose
|
|
55
|
+
# author can push here anyway), but for a fork's, as text: its run
|
|
56
|
+
# ran the fork's code, which could have written anything in it. In
|
|
57
|
+
# a code block, fenced with more backticks than any run of them in
|
|
58
|
+
# the report, it can't mention anyone, link anywhere or show an
|
|
59
|
+
# image. (And it's cut short where a comment couldn't hold it.)
|
|
60
|
+
report() {
|
|
61
|
+
if [ "${head#* }" = "$GITHUB_REPOSITORY" ]; then cat "$RUNNER_TEMP/report/duel.md" && return; fi
|
|
62
|
+
fence=$(grep -o '``*' "$RUNNER_TEMP/report/duel.md" | awk '{ if (length > n) n = length } END { n = (n < 3) ? 3 : n + 1; while (n-- > 0) printf "`" }')
|
|
63
|
+
printf 'From a fork, so shown as text:\n\n%s\n' "$fence"
|
|
64
|
+
head -c 60000 "$RUNNER_TEMP/report/duel.md"
|
|
65
|
+
printf '\n%s\n' "$fence"
|
|
66
|
+
}
|
|
51
67
|
marker="<!-- duel<%= " #{working_directory}" if working_directory %>"
|
|
52
68
|
# The first line of the last comment Duel posted here: its marker,
|
|
53
69
|
# with its status (none in Duel 0.1.0's, which counts as another).
|
|
54
70
|
last=$(gh api --paginate "repos/$GITHUB_REPOSITORY/issues/$PR/comments" \
|
|
55
71
|
--jq ".[] | select(.user.login == \"github-actions[bot]\") | .body | split(\"\n\")[0] | rtrimstr(\"\r\") | select(startswith(\"$marker status=\") or . == \"$marker -->\")" | tail -n 1)
|
|
56
72
|
if [ "$COMMENT" = post ] || { [ -n "$last" ] && [ "$last" != "$marker status=$STATUS -->" ]; }; then
|
|
57
|
-
{ echo "$marker status=$STATUS -->";
|
|
73
|
+
{ echo "$marker status=$STATUS -->"; report; } > "$RUNNER_TEMP/comment.md"
|
|
58
74
|
gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$PR/comments" -F body=@"$RUNNER_TEMP/comment.md" > /dev/null
|
|
59
75
|
fi
|
|
@@ -185,6 +185,7 @@ jobs:
|
|
|
185
185
|
path: ${{ runner.temp }}/duel/
|
|
186
186
|
if-no-files-found: ignore # none when Duel didn't get to compare
|
|
187
187
|
retention-days: 1
|
|
188
|
+
<% if comment_on_pushes? -%>
|
|
188
189
|
|
|
189
190
|
# The report, as a new comment on a pushed commit, which notifies its
|
|
190
191
|
# author, when Duel says to, as for a pull request (see the Perf comment
|
|
@@ -221,6 +222,8 @@ jobs:
|
|
|
221
222
|
{ echo "$marker status=$STATUS -->"; cat "$RUNNER_TEMP/report/duel.md"; } > "$RUNNER_TEMP/comment.md"
|
|
222
223
|
gh api --method POST "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments" -F body=@"$RUNNER_TEMP/comment.md" > /dev/null
|
|
223
224
|
fi
|
|
225
|
+
<% end -%>
|
|
226
|
+
<% if mark_passed? -%>
|
|
224
227
|
|
|
225
228
|
# With c.push_base = :last_passed in .duel.rb, a push is compared with
|
|
226
229
|
# the last commit Duel passed, which a branch marks (each branch pushed
|
|
@@ -274,6 +277,8 @@ jobs:
|
|
|
274
277
|
diverged | behind | unrelated) gh api --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/heads/$BRANCH" -f sha="$GITHUB_SHA" -F force=true > /dev/null ;;
|
|
275
278
|
*) echo "::error::Couldn't compare $BRANCH with this push: $compared" && exit 1 ;;
|
|
276
279
|
esac
|
|
280
|
+
<% end -%>
|
|
281
|
+
<% if badge? -%>
|
|
277
282
|
|
|
278
283
|
# Duel's badge, for the README: green (perf guarded) or red (perf
|
|
279
284
|
# regressed), as the last push to the default branch that Duel compared
|
|
@@ -285,10 +290,18 @@ jobs:
|
|
|
285
290
|
#
|
|
286
291
|
# [}" if working_directory %>/badge.svg)](https://github.com/sferik/duel-ruby)
|
|
287
292
|
#
|
|
288
|
-
# It checks nothing out
|
|
293
|
+
# It checks nothing out, runs none of the code, and fetches nothing.
|
|
289
294
|
badge:
|
|
290
295
|
name: Update the badge
|
|
291
296
|
needs: duel
|
|
297
|
+
# One at a time, so that one run's check of which push the badge
|
|
298
|
+
# shows can't interleave with another run's write (a push's run
|
|
299
|
+
# doesn't wait for the one before it). A badge job that's running is
|
|
300
|
+
# never cancelled, and one that's waiting gives way to a newer push's,
|
|
301
|
+
# whose result the badge should show anyway.
|
|
302
|
+
concurrency:
|
|
303
|
+
group: ${{ github.workflow }}-badge
|
|
304
|
+
cancel-in-progress: false
|
|
292
305
|
if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch && (needs.duel.result == 'failure' || needs.duel.outputs.status == 'passed' || needs.duel.outputs.status == 'failed') }}
|
|
293
306
|
runs-on: ubuntu-latest
|
|
294
307
|
permissions:
|
|
@@ -300,7 +313,6 @@ jobs:
|
|
|
300
313
|
BRANCH: duel/badge<%= "-#{working_directory.tr("/", "-")}" if working_directory %>
|
|
301
314
|
RESULT: ${{ needs.duel.result }}
|
|
302
315
|
STATUS: ${{ needs.duel.outputs.status }}
|
|
303
|
-
BADGES: https://raw.githubusercontent.com/sferik/duel-ruby/main/assets
|
|
304
316
|
run: |
|
|
305
317
|
# (Git can't make a branch where another's name is a folder of its
|
|
306
318
|
# name: a branch named duel blocks duel/passed/main. If one does,
|
|
@@ -319,11 +331,59 @@ jobs:
|
|
|
319
331
|
# Its commit names the push.)
|
|
320
332
|
last=$(gh api "repos/$GITHUB_REPOSITORY/commits/$BRANCH" --jq .commit.message 2>/dev/null | sed -n 's/^Duel.s badge, for \([0-9a-f]*\)$/\1/p') || true
|
|
321
333
|
if [ -n "$last" ] && [ "$(gh api "repos/$GITHUB_REPOSITORY/compare/$GITHUB_SHA...$last" --jq .status 2>/dev/null)" = ahead ]; then exit 0; fi
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
334
|
+
# (Its image, written here rather than fetched from anywhere: green,
|
|
335
|
+
# or red where the Duel job failed or found a regression.)
|
|
336
|
+
state="perf guarded" width=133 top="#34D058" bottom="#28A745" right="76.939C78.629 0 80 1.343 80"
|
|
337
|
+
if [ "$RESULT" = failure ] || [ "$STATUS" = failed ]; then
|
|
338
|
+
state="perf regressed" width=142 top="#EA4A5A" bottom="#D73A49" right="85.939C87.629 0 89 1.343 89"
|
|
339
|
+
fi
|
|
340
|
+
cat > "$RUNNER_TEMP/badge.svg" <<SVG
|
|
341
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="$width" height="20">
|
|
342
|
+
<title>Duel - $state</title>
|
|
343
|
+
<defs>
|
|
344
|
+
<linearGradient id="duel-fill" x1="50%" y1="0%" x2="50%" y2="100%">
|
|
345
|
+
<stop stop-color="#444D56" offset="0%"></stop>
|
|
346
|
+
<stop stop-color="#24292E" offset="100%"></stop>
|
|
347
|
+
</linearGradient>
|
|
348
|
+
<linearGradient id="state-fill" x1="50%" y1="0%" x2="50%" y2="100%">
|
|
349
|
+
<stop stop-color="$top" offset="0%"></stop>
|
|
350
|
+
<stop stop-color="$bottom" offset="100%"></stop>
|
|
351
|
+
</linearGradient>
|
|
352
|
+
</defs>
|
|
353
|
+
<g fill="none" fill-rule="evenodd">
|
|
354
|
+
<g font-family="'DejaVu Sans',Verdana,Geneva,sans-serif" font-size="11">
|
|
355
|
+
<path d="M0,3 C0,1.3431 1.3552,0 3.02702703,0 L53,0 L53,20 L3.02702703,20 C1.3552,20 0,18.6569 0,17 L0,3 Z" fill="url(#duel-fill)" fill-rule="nonzero"></path>
|
|
356
|
+
<text fill="#010101" fill-opacity=".3">
|
|
357
|
+
<tspan x="22.1981982" y="15" aria-hidden="true">Duel</tspan>
|
|
358
|
+
</text>
|
|
359
|
+
<text fill="#FFFFFF">
|
|
360
|
+
<tspan x="22.1981982" y="14">Duel</tspan>
|
|
361
|
+
</text>
|
|
362
|
+
</g>
|
|
363
|
+
<g transform="translate(53)" font-family="'DejaVu Sans',Verdana,Geneva,sans-serif" font-size="11">
|
|
364
|
+
<path d="M0 0h$right 3v14c0 1.657-1.37 3-3.061 3H0V0z" fill="url(#state-fill)" fill-rule="nonzero"></path>
|
|
365
|
+
<text fill="#010101" fill-opacity=".3" aria-hidden="true">
|
|
366
|
+
<tspan x="4" y="15">$state</tspan>
|
|
367
|
+
</text>
|
|
368
|
+
<text fill="#FFFFFF">
|
|
369
|
+
<tspan x="4" y="14">$state</tspan>
|
|
370
|
+
</text>
|
|
371
|
+
</g>
|
|
372
|
+
<g fill="#959DA5">
|
|
373
|
+
<path d="M4.6 3.6L6.9 4.5L14.3 11.9L12.9 13.3L5.5 5.9Z M17.4 3.6L15.1 4.5L7.7 11.9L9.1 13.3L16.5 5.9Z"></path>
|
|
374
|
+
<circle cx="16.6" cy="15.6" r="1.1"></circle>
|
|
375
|
+
<circle cx="5.4" cy="15.6" r="1.1"></circle>
|
|
376
|
+
</g>
|
|
377
|
+
<g stroke="#959DA5" stroke-linecap="round">
|
|
378
|
+
<path d="M12.1 14.5L15.5 11.1 M9.9 14.5L6.5 11.1" stroke-width="1.6"></path>
|
|
379
|
+
<path d="M13.8 12.8L16 15 M8.2 12.8L6 15" stroke-width="1.8"></path>
|
|
380
|
+
</g>
|
|
381
|
+
</g>
|
|
382
|
+
</svg>
|
|
383
|
+
SVG
|
|
325
384
|
tree=$(jq -n --rawfile svg "$RUNNER_TEMP/badge.svg" '{tree: [{path: "badge.svg", mode: "100644", type: "blob", content: $svg}]}' |
|
|
326
385
|
gh api --method POST "repos/$GITHUB_REPOSITORY/git/trees" --input - --jq .sha)
|
|
327
386
|
commit=$(gh api --method POST "repos/$GITHUB_REPOSITORY/git/commits" -f message="Duel's badge, for $GITHUB_SHA" -f tree="$tree" --jq .sha)
|
|
328
387
|
gh api --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/heads/$BRANCH" -f sha="$commit" -F force=true > /dev/null 2>&1 ||
|
|
329
388
|
gh api --method POST "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/heads/$BRANCH" -f sha="$commit" > /dev/null || blocked
|
|
389
|
+
<% end -%>
|
data/sig/duel/rails.rbs
CHANGED
|
@@ -229,6 +229,22 @@ module Duel
|
|
|
229
229
|
|
|
230
230
|
private
|
|
231
231
|
|
|
232
|
+
@settings: Config?
|
|
233
|
+
|
|
234
|
+
# The app's settings, which decide the workflow's jobs (nil where
|
|
235
|
+
# .duel.rb doesn't load).
|
|
236
|
+
def settings: () -> Config?
|
|
237
|
+
def load_settings: () -> Config?
|
|
238
|
+
|
|
239
|
+
# Whether the workflow comments on a pushed commit.
|
|
240
|
+
def comment_on_pushes?: () -> bool
|
|
241
|
+
|
|
242
|
+
# Whether the workflow marks a push passed.
|
|
243
|
+
def mark_passed?: () -> bool
|
|
244
|
+
|
|
245
|
+
# Whether the workflow keeps a badge for the README.
|
|
246
|
+
def badge?: () -> bool
|
|
247
|
+
|
|
232
248
|
# The app's Gemfile.
|
|
233
249
|
def gemfile: () -> String
|
|
234
250
|
|