jobs: test: name: Test # ... deploy: name: Deploy needs: test if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') # ... The deploy job has a needs: test statement that will only run the Deploy job if the Test job was successful.
Full article