Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Support sbt-github-actions (resolves #9) #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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