|
|
@@ -0,0 +1,95 @@
|
|
|
+# This is a basic workflow to help you get started with Actions
|
|
|
+
|
|
|
+name: Commit Format and Import Sort
|
|
|
+
|
|
|
+# Controls when the action will run.
|
|
|
+on:
|
|
|
+ # Triggers the workflow on push or pull request events but only for the master branch
|
|
|
+ push:
|
|
|
+ branches: [ master ]
|
|
|
+ pull_request:
|
|
|
+ branches: [ master ]
|
|
|
+
|
|
|
+ # Allows you to run this workflow manually from the Actions tab
|
|
|
+ workflow_dispatch:
|
|
|
+
|
|
|
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
|
+jobs:
|
|
|
+ # This workflow contains a single job called "build"
|
|
|
+ build:
|
|
|
+ # The type of runner that the job will run on
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+
|
|
|
+ # Steps represent a sequence of tasks that will be executed as part of the job
|
|
|
+ steps:
|
|
|
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
|
+ - uses: actions/checkout@v2
|
|
|
+ # with: # https://github.com/stefanzweifel/git-auto-commit-action#checkout-the-correct-branch
|
|
|
+ # ref: ${{ github.head_ref }}
|
|
|
+
|
|
|
+ - uses: actions/setup-python@v2
|
|
|
+ with:
|
|
|
+ python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
|
|
+ architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
|
|
+
|
|
|
+ - uses: Gr1N/setup-poetry@v4
|
|
|
+
|
|
|
+ - run: poetry install
|
|
|
+
|
|
|
+# - run: poetry --version
|
|
|
+
|
|
|
+ # - run: ls -la
|
|
|
+
|
|
|
+ - run: poetry run black --check .
|
|
|
+
|
|
|
+ - name: Format if check failed
|
|
|
+ if: failure()
|
|
|
+ run: |
|
|
|
+ printenv | grep GITHUB
|
|
|
+ git config --global user.name 'ndbeals'
|
|
|
+ git config --global user.email 'ndbeals@users.noreply.github.com'
|
|
|
+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
|
|
+ git remote -v
|
|
|
+ git branch
|
|
|
+ git status
|
|
|
+ poetry run black .
|
|
|
+ git status
|
|
|
+ echo ready to commit
|
|
|
+ git add .
|
|
|
+ git commit -m "Code reformatted with psf/black"
|
|
|
+ echo ready to push
|
|
|
+ git push
|
|
|
+ # git push --force origin
|
|
|
+
|
|
|
+ - name: Isort
|
|
|
+ run: poetry run isort --check .
|
|
|
+
|
|
|
+ - name: Isort if check failed
|
|
|
+ if: failure()
|
|
|
+ run: |
|
|
|
+ printenv | grep GITHUB
|
|
|
+ git config --global user.name 'ndbeals'
|
|
|
+ git config --global user.email 'ndbeals@users.noreply.github.com'
|
|
|
+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
|
|
+ git remote -v
|
|
|
+ git branch
|
|
|
+ git status
|
|
|
+ poetry run isort --check .
|
|
|
+ git status
|
|
|
+ echo ready to commit
|
|
|
+ git add .
|
|
|
+ git commit -m "Imports sorted with isort"
|
|
|
+ echo ready to push
|
|
|
+ git push
|
|
|
+ # git push --force origin
|
|
|
+
|
|
|
+
|
|
|
+# # Runs a single command using the runners shell
|
|
|
+# - name: Run a one-line script
|
|
|
+# run: echo Hello, world!
|
|
|
+
|
|
|
+# # Runs a set of commands using the runners shell
|
|
|
+# - name: Run a multi-line script
|
|
|
+# run: |
|
|
|
+# echo Add other actions to build,
|
|
|
+# echo test, and deploy your project.
|