Skip to content

Commit 6cb1642

Browse files
author
Jeff May
committed
- Adds sbt-github-actions hook
1 parent f41e9c9 commit 6cb1642

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.pre-commit-hooks.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@
3030
pass_filenames: false
3131
always_run: true
3232
minimum_pre_commit_version: '0.19.0'
33+
- id: sbt-github-actions
34+
name: Generate github workflows using sbt-github-actions plugin
35+
language: python_venv
36+
stages: [commit,push]
37+
entry: sbt-github-actions
38+
pass_filenames: false
39+
always_run: true
40+
minimum_pre_commit_version: '0.19.0'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from pre_commit_hooks.runner import run_sbt_command
2+
from colorama import init as colorama_init, Fore
3+
4+
SBT_TASK = 'githubWorkflowGenerate'
5+
MISSING_PLUGIN_CHECK_STRING = f'Not a valid key: {SBT_TASK}'
6+
MISSING_PLUGIN_ERROR_MSG = f'{Fore.RED}ERROR: sbt-github-actions SBT plugin not present! See {Fore.BLUE}https://github.com/djspiewak/sbt-github-actions#sbt-github-actions{Fore.RED} for installation instructions.'
7+
8+
9+
def main(argv=None):
10+
colorama_init()
11+
return run_sbt_command(f'; clean ; {SBT_TASK}', MISSING_PLUGIN_CHECK_STRING, MISSING_PLUGIN_ERROR_MSG)
12+
13+
14+
if __name__ == '__main__':
15+
exit(main())

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ console_scripts =
1313
sbt-wartremover = pre_commit_hooks.sbt_wartremover:main
1414
scalafmt = pre_commit_hooks.scalafmt:main
1515
sbt-fatal-warnings = pre_commit_hooks.sbt_fatal_warnings:main
16+
sbt-github-actions = pre_commit_hooks.sbt_github_actions:main

0 commit comments

Comments
 (0)