Skip to content
Closed
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
21 changes: 21 additions & 0 deletions .github/workflows/description-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: description check
on:
pull_request:
permissions:
contents: read
pull-requests: write
id-token: write
checks: write
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: lemahq/lema-verify@v1
with:
api-url: https://lema-api-4wojvodvaq-uc.a.run.app # STAGE — not api.lema.sh
github-token: ${{ github.token }}
record-decisions: true
22 changes: 22 additions & 0 deletions retry/retry.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Package retry retries an operation with exponential backoff.
package retry

import "time"

// Do runs fn up to attempts times. After each failure it waits, doubling the
// delay each round (exponential backoff), and returns the final error if every
// attempt fails.
func Do(attempts int, base time.Duration, fn func() error) error {
delay := base
var err error
for i := 0; i < attempts; i++ {
if err = fn(); err == nil {
return nil
}
if i < attempts-1 {
time.Sleep(delay)
delay *= 2
}
}
return err
}
Loading