Skip to content

Latest commit

 

History

History
109 lines (85 loc) · 4.72 KB

configuration.md

File metadata and controls

109 lines (85 loc) · 4.72 KB

prtweeter Configuration

The configuration is saved in edn format which should be pretty self-explanatory. It's used to store the necessary github and twitter configuration but also to keep track of the last PR posted, to figure out which PRs are actually new.

Even though the file is autogenerated and updated after each run you can edit and even reformat it and add comments which will be preserved. But you should take care to not break the general structure or delete any keys.

Since it contains your twitter credentials you should keep this file at a safe location and not put online in any case.

Configuration file location

On startup pr-tweeter first looks for a file called .pr-tweeter.edn in your current working directory. If this isn't found it's read from $XDG_CONFIG_HOME/prtweeter.edn if the XDG_CONFIG_HOME environment variable is set, otherwise from $HOME/.config/pr-tweeter.edn.

If you want to use a different directory without changing XDG_CONFIG_HOME you can set it as a java system property (e.g. with the -DXDG_CONFIG_HOME=/my/path/to/config command line option to the java command).

If you are a developer and need a specific config location the most convenient option might be to create a .lein-env file in the project root directory with these contents:

{ :xdg-config-home "/my/path/to/config" }

Changing earliest PR which is considered for tweeting

In order to avoid publishing old PRs just because they are open a date filter is applied. The initial earliest date considered is the time when the configuration is created first. You might want to change this default e.g. if you want to publish earlier PRs or only later ones. You can configure this date via the :earliest-pr setting, whereas the conventions of RFC3999 are followed for the date format.

Please keep in mind that these date is updated to the opening date of the latest PR which is tweeted during a pr-tweeter run.

Changing the limit of PRs tweeted in one run

By default a maximum of 5 PRs is tweeted per run which should be a safeguard to avoid spamming twitter in a case of a misconfiguration. This shouldn't be a problem since you can just issue another run if there are unpublished PRs left. But in case you want to change this number you can do so with the :pr-limit-per-run setting.

Customizing the tweet

The default template for the generated tweet is

{{name|abbr-ellipsis:…|abbreviate:15}} PR by {{login|abbr-ellipsis:…|abbreviate:12}} on {{created_at|date:\"M/d/yy HH:mm z\":us}}: {{title|abbr-ellipsis:…|abbreviate:60}} {{html_url}}

You can use all filters as specified by the Selmer template system and as exemplified by the created_at date filtering above.

Since date filtering is probably the most interesting usecase, the results of predefined format filters are demonstrated here:

 Filter               Result when applied to created_at for 2018-01-02
-----------------------------------------------------------------------
 no filter            Tue Jan 02 08:00:00 CST 2018
 date:shortDate       1/2/18
 date:shortTime       8:00 AM
 date:shortDateTime   1/2/18 8:00 AM
 date:mediumDate      Jan 2, 2018
 date:mediumTime      8:00:00 AM
 date:mediumDateTime  Jan 2, 2018 8:00:00 AM
 date:longDate        January 2, 2018
 date:longTime        8:00:00 AM CST
 date:longDateTime    January 2, 2018 8:00:00 AM CST
 date:fullDate        Tuesday, January 2, 2018
 date:fullTime        8:00:00 AM CST
 date:fullDateTime    Tuesday, January 2, 2018 8:00:00 AM CST

Note: if you use a date filter and don't specify an explicit locale (e.g by appending :us to the filter) the locale settings of your environment apply.

The default template is designed for the old 140 character limit, but if the new 280 limit applies for you and you wish to have longer titles included you can adapt the template accordingly. Also if the repo name is implied by your twitter account its probably prudent to leave it out.

Note: a URL always counts as 23 characters against the limit, even when it's shortened by the automatic Twitter URL shortener service.

The list of available keywords (which can be referenced by double curly braces in the template) is as follows

name        Name of the repository
descr       Description of the repository
login       Github login name of the PR creator
created_at  creation date/time of the PR
title       Title of the PR
html_url    The browser friendy URL to the PR
base        The branch against this PR was made
body        The main description of the PR
assignee    The assignee of the PR (probably empty for most new PRs)