<commit_before># VersionBot

VersionBot is a CI tool designed to help engineers with PRs, linting commits, ensuring reviews have been made by appropriate Github users and finally bumping the version of a component when it's merged to the `master` branch. In brief, it will:

* Look for new PRs and check that there is at least one commit in the PR which features a suitable `Change-Type:` tag
* Look for required status checks (such as other CI systems) that fail, and then alert the author of the PR
* Prevent manual merging of a PR using a 'AutoMerge' status check
* Suppress any warnings (or merging) for a PR should it find the `flow/in-progress` label. This allows Work-In-Progress to occur with minimal interruptions by VersionBot.
* Look for PR review approvals ***and*** a label applied to the PR to mark it ready for merge (`procbots/versionbot/ready-to-merge`)
* On seeing appropriate label and review, will automatically:
    1. Clone the PR branch for the repo
    2. Run `versionist` upon it. Should a `versionist.conf.js` config file exist in the root of the repo, then this is used in preference to the in-built default config.
    3. Should a new version be generated, commit any appropriate files (eg. `CHANGELOG.md`, `package.json`) to the branch
    4. Merge the branch back into the head
    5. Delete the PR branch

If a PR branch is out of step with the `master` branch, `VersionBot` will refuse to merge (and will not update the versions of files).

Merges and checks can be suppressed using the `procbots/versionbot/no-checks` label on a PR.

## Creating a Github Integration

Follow the instructions on [making a GitHub integration](https://github.com/resin-io-modules/resin-procbots/blob/master/docresources/Services/GitHub/integration.md#creating-a-github-integration)
with the following notes:

* The Webhook Path should be `/webhooks`.
* The Webhook Port should be `4567`.
* The Permissions it needs are:
	- Repository metadata: R/O
	- Repository administration: R/O
	- Commit statuses: R/W
		# Status
	- Deployments: R/W
		# Deployment
		# Deployment status
	- Issues:
		# Issue comment: R/W
		# Issues: R/W
	- Pull Requests: R/W
		# Pull request
		# Pull request review
		# Pull request review comment
	- Repository contents: R/W
		# Commit comment
		# Create
		# Delete
		# Fork
		# Push
		# Release


## Secret Key, Webhook Token and Integration ID

`VersionBot` requires the following environment variables:

* `VERSIONBOT_WEBHOOK_SECRET`: The 20 digit hex key used to authenticate messages.
* `VERSIONBOT_INTEGRATION_ID`: The ID given on Integration creation, a unique identifier.
* `VERSIONBOT_PEM`: The Base64 encoded private key generated on Integration creation.
* `VERSIONBOT_NAME`: The name shown in commits and merges for PRs by the Integration.
* `VERSIONBOT_EMAIL`: Email address for the bot, (can be an empty string).
* `VERSIONBOT_USER`: Can be an empty string.<commit_msg>Versionbot: Clean up readme formatting<commit_after># VersionBot

VersionBot is a CI tool designed to help engineers with PRs, linting commits, ensuring reviews have been made by appropriate Github users and finally bumping the version of a component when it's merged to the `master` branch. In brief, it will:

* Look for new PRs and check that there is at least one commit in the PR which features a suitable `Change-Type:` tag
* Look for required status checks (such as other CI systems) that fail, and then alert the author of the PR
* Prevent manual merging of a PR using a 'AutoMerge' status check
* Suppress any warnings (or merging) for a PR should it find the `flow/in-progress` label. This allows Work-In-Progress to occur with minimal interruptions by VersionBot.
* Look for PR review approvals ***and*** a label applied to the PR to mark it ready for merge (`procbots/versionbot/ready-to-merge`)
* On seeing appropriate label and review, will automatically:
    1. Clone the PR branch for the repo
    2. Run `versionist` upon it. Should a `versionist.conf.js` config file exist in the root of the repo, then this is used in preference to the in-built default config.
    3. Should a new version be generated, commit any appropriate files (eg. `CHANGELOG.md`, `package.json`) to the branch
    4. Merge the branch back into the head
    5. Delete the PR branch

If a PR branch is out of step with the `master` branch, `VersionBot` will refuse to merge (and will not update the versions of files).

Merges and checks can be suppressed using the `procbots/versionbot/no-checks` label on a PR.

## Creating a Github Integration

Follow the instructions on [making a GitHub integration](https://github.com/resin-io-modules/resin-procbots/blob/master/docresources/Services/GitHub/integration.md#creating-a-github-integration)
with the following notes:

* The Webhook Path should be `/webhooks`.
* The Webhook Port should be `4567`.
* The Permissions it needs are:
	- Repository metadata: R/O
	- Repository administration: R/O
	- Commit statuses: R/W
		- **Status**
	- Deployments: R/W
		- **Deployment**
		- **Deployment status**
	- Issues:
		- **Issue comment: R/W**
		- **Issues: R/W**
	- Pull Requests: R/W
		- **Pull request**
		- **Pull request review**
		- **Pull request review comment**
	- Repository contents: R/W
		- **Commit comment**
		- **Create**
		- **Delete**
		- **Fork**
		- **Push**
		- **Release**


## Secret Key, Webhook Token and Integration ID

`VersionBot` requires the following environment variables:

* `VERSIONBOT_WEBHOOK_SECRET`: The 20 digit hex key used to authenticate messages.
* `VERSIONBOT_INTEGRATION_ID`: The ID given on Integration creation, a unique identifier.
* `VERSIONBOT_PEM`: The Base64 encoded private key generated on Integration creation.
* `VERSIONBOT_NAME`: The name shown in commits and merges for PRs by the Integration.
* `VERSIONBOT_EMAIL`: Email address for the bot, (can be an empty string).
* `VERSIONBOT_USER`: Can be an empty string.
{'fraction_non_alphanumeric': 0.08025004223686434, 'fraction_numerical': 0.004392633890859942, 'mean_word_length': 4.06415739948674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4538173', 'n_tokens_mistral': 1763, 'n_tokens_neox': 1664, 'n_words': 803}