chulin
chulin

Reputation: 53

Workflow not showing up in GitHub Actions

I am doing a continuous integration workflow in GitHub Actions to trigger "pytest backend/tests/" command on a push to any branch. Right now, I am testing in a feature branch. The pytest.yml file is located in /.github/workflows/. The GitHub actions is not showing my workflow, even after I push new changes.

This is my pytest.yml file

name: Run pytest on push

on:
  push:
    branches:
      - '*'

jobs:
  pytest:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.9

    - name: Install dependencies
      run: pip install -r requirements.txt

    - name: Run pytest
      run: pytest backend/tests

Upvotes: 3

Views: 14514

Answers (3)

abellis
abellis

Reputation: 31

It's a bit embarrassing, but in my case, I accidentally removed the '.yml' extension from the workflow file when I first created it. As a result, 'the workflow' wasn't listed under 'All workflows' because it was just a plain text file.

Upvotes: 1

Dayananda D R
Dayananda D R

Reputation: 437

try this -

'*' - Matches all the branches except branches containg slashes ("/")

'**' - Matches all the branches

name: Run pytest on push

on:
  push:
    branches:
      - '**'

Upvotes: 3

Robin Thomas
Robin Thomas

Reputation: 4146

Your workflow will not show up in the Actions tab until it's merged to the main branch.

The reason is because certain triggers (like push, workflow_dispatch) requires the new workflow to be merged to main branch first before showing up in Actions tab.

So to solve this, you can instead use the pull_request trigger, like:

on:
  pull_request:

Then the action should come up in the Actions tab, even before you merge your changes to the main branch.

Upvotes: 6

Related Questions