File: db_pull_request

package info (click to toggle)
ruby-mini-mime 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 344 kB
  • sloc: ruby: 209; makefile: 4; sh: 4
file content (20 lines) | stat: -rwxr-xr-x 824 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env ruby
# frozen_string_literal: true

require "time"

if `git status --porcelain lib/db`.empty?
  puts "Skipping, no DB changes to commit..."
  return
end

moment = Time.now.utc
branch_name = "db-updates-#{moment.strftime("%Y%m%d%H%M%S")}"

system("git", "checkout", "-b", branch_name) || abort("Unable to create branch")
system("git", "add", "lib/db")
system("git", "config", "--local", "user.email", "actions@github.com")
system("git", "config", "--local", "user.name", "github-actions")
system("git", "commit", "-m", "DB updates #{moment.iso8601}") || abort("Unable to commit changes")
system("git", "push", "-u", "origin", branch_name) || abort("Unable to push branch")
system("gh", "pr", "create", "--title", "DB updates #{moment.iso8601}", "--body", "From Github Actions") || abort("Unable to create PR")