Skip to content

Commit

Permalink
Merge pull request #2 from jchristgit/soviet-propaganda
Browse files Browse the repository at this point in the history
Add Soviet propaganda
  • Loading branch information
jb3 authored Jun 19, 2024
2 parents c0f4d73 + cdf4475 commit 5279644
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ The following environment variables must be set:

You can also optionally set these variables:

| Variable | Description | Default |
|------------------|-------------------------------------------------------|----------------------|
| `FF_POLICY_FILE` | The file to read for policy on who can perform merges | `.github/ff-bot.yml` |
| `FF_LISTEN_PORT` | The HTTP port for the service to listen on | 4000 |
| Variable | Description | Default |
|--------------------|------------------------------------------------------------------------------------------|----------------------|
| `FF_POLICY_FILE` | The file to read for policy on who can perform merges | `.github/ff-bot.yml` |
| `FF_LISTEN_PORT` | The HTTP port for the service to listen on | 4000 |
| `FF_NO_PROPAGANDA` | Disable all team encouragement messages generated by the bot on merged Pull Requests. | |

## Usage

Expand Down
3 changes: 2 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ config :ff_bot,
github_client_id: System.fetch_env!("GITHUB_CLIENT_ID"),
github_client_secret: System.fetch_env!("GITHUB_CLIENT_SECRET") |> String.replace("\\n", "\n"),
policy_file: System.get_env("FF_POLICY_FILE", ".github/ff-bot.yml"),
service_port: System.get_env("FF_LISTEN_PORT", "4000") |> String.to_integer()
service_port: System.get_env("FF_LISTEN_PORT", "4000") |> String.to_integer(),
disable_propaganda?: System.get_env("FF_NO_PROPAGANDA")
10 changes: 9 additions & 1 deletion lib/ff_bot/github/merger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule FFBot.GitHub.Merger do
pull_request["number"],
:success,
"Successfully fast-forwarded commits from `#{pull_request["head"]["label"]}` " <>
"onto `#{repo["default_branch"]}`"
"onto `#{repo["default_branch"]}`" <> maybe_propaganda()
)
end

Expand All @@ -66,4 +66,12 @@ defmodule FFBot.GitHub.Merger do
defp push_changes(cloned) do
{:ok, _} = Git.push(cloned)
end

defp maybe_propaganda do
if Application.get_env(:ff_bot, :disable_propaganda?) == nil and :rand.uniform() < 0.01 do
". Glory to Arstotzka!"
else
""
end
end
end

0 comments on commit 5279644

Please sign in to comment.