-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider increasing accuracy of pull request merging trigger #2
Comments
The code you have provided is an if statement that checks if the following conditions are met: The repository owner is not githublearn. This code could be used to run a workflow only if the repository owner is not githublearn and the event is either a workflow dispatch or a pull request that has been merged and the head ref is pr_branch_name. For example, you could use this code to run a workflow that deploys a new version of your application to production only if the repository owner is not githublearn and the pull request has been merged and the head ref is pr_branch_name. Here is a breakdown of the code: if: >- The next line of code is a nested conditional statement. This statement checks if the following conditions are met: The repository owner is not githublearn. If the nested conditional statement is true, the if statement will execute the code that follows it. |
This comment has been minimized.
This comment has been minimized.
es muy interesante y ayuda mucho el curso |
We currently use pushes to the
main
branch as the trigger for checking that a pull request was merged:https://github.com/githublearn/introduction-to-github/blob/60017ba97de7a27dcd93d192d238c00cc280dfb0/.github/workflows/4-merge-your-pull-request.yml#L7-L13
While it's true that merging a PR into the
main
branch will trigger in just such an event, it is also true that many other activities (like editing in the UI, other pushes, merging other PRs, etc.) could also result in that trigger. 😅As such, we may want to consider increasing the accuracy of this event trigger if any folks start reporting such issues. 🤷🏻♂️
e.g. suggested:
Plus updating the job-level
if
from:https://github.com/githublearn/introduction-to-github/blob/60017ba97de7a27dcd93d192d238c00cc280dfb0/.github/workflows/4-merge-your-pull-request.yml#L24-L29
to:
We could also get specific about the name of the PR head branch, if that makes sense:
workflow_dispatch
, we would need to tweak theif
condition further as well, e.g. something like:The text was updated successfully, but these errors were encountered: