I'm relatively new to Git Hub, and the problem is I have created 2 branches main, dev. dev is not protected anyone can push on it and main is push-protected only upon PRs. I want to create a GitHub workflow as follows
name: Code coverage & flake8
on:
push:
branches: [ dev ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8
- name: Coverage report
run: |
pip install coverage
coverage run manage.py test
coverage report
coverage HTML`
however, this workflow doesn't appear on the GitHub actions tab. I have tried to push it into main to test it and it starts to appear but I can't run it manually also.
First, you need to merge your workflow file to the default branch, before it shall appear in the Actions tab of your repo.
Second, you had set it to trigger on push
.
on:
push:
branches: [ dev ]
workflow_dispatch:
You need to update it to:
on:
push:
branches: [ dev ]
workflow_dispatch:
So that you can manually trigger the workflow as well (once the above code is merged).