Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Adds sbt-github-actions hook
  • Loading branch information
Jeff May committed Oct 7, 2022
1 parent f41e9c9 commit 6cb1642
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@
pass_filenames: false
always_run: true
minimum_pre_commit_version: '0.19.0'
- id: sbt-github-actions
name: Generate github workflows using sbt-github-actions plugin
language: python_venv
stages: [commit,push]
entry: sbt-github-actions
pass_filenames: false
always_run: true
minimum_pre_commit_version: '0.19.0'
15 changes: 15 additions & 0 deletions pre_commit_hooks/sbt_github_actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pre_commit_hooks.runner import run_sbt_command
from colorama import init as colorama_init, Fore

SBT_TASK = 'githubWorkflowGenerate'
MISSING_PLUGIN_CHECK_STRING = f'Not a valid key: {SBT_TASK}'
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.'


def main(argv=None):
colorama_init()
return run_sbt_command(f'; clean ; {SBT_TASK}', MISSING_PLUGIN_CHECK_STRING, MISSING_PLUGIN_ERROR_MSG)


if __name__ == '__main__':
exit(main())
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ console_scripts =
sbt-wartremover = pre_commit_hooks.sbt_wartremover:main
scalafmt = pre_commit_hooks.scalafmt:main
sbt-fatal-warnings = pre_commit_hooks.sbt_fatal_warnings:main
sbt-github-actions = pre_commit_hooks.sbt_github_actions:main

0 comments on commit 6cb1642

Please sign in to comment.