Docker and CI/CD · Middle · Question 45 of 75
How do you run a deploy step only for pushes to main?
- 1
when: branch == main - 2
only: mainat the top of the step - ✓Correct answer:
if: github.ref == 'refs/heads/main'
Explanation
Expressions in if: can check the event, branch, previous results (success(), failure()) and more. only: is GitLab's older syntax.