You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change pull request so that it will work for any PR, with no restriction to specific branches. This will make it run for any PR merging into any personal or shared development branch. Suggest the following:
on:
pull_request:
types: [opened, synchronize, reopened]
Rename "development" to "SharedDevelopment"
This will need to be a hotfix, to merge into both "master" and "SharedDevelopment". See next comment for (lengthy, of course) LLM explanation.
The text was updated successfully, but these errors were encountered:
When you create a pull request to merge branch A into branch B on GitHub, the version of the action that will run is the one from the base branch of the pull request, which in this case is branch B[1][8]. This is because GitHub Actions uses the workflow definition from the base branch when processing pull requests.
Here's a breakdown of how this works:
Workflow Execution for Pull Requests
Base Branch Workflow: When a pull request is opened or updated, GitHub Actions looks at the workflow files in the base branch (branch B in this case) to determine which actions to run[8].
Context of Execution: The workflow runs in the context of the merge commit that would result if the pull request were to be merged at that moment[1].
Ignoring Head Branch Workflow: Any workflow files in the head branch (branch A) are not considered for execution in this scenario[1].
Important Considerations
Workflow File Location: The workflow file must be present in the default branch (usually master or main) for it to run on pull requests[8]. However, the specific version of the action that runs is determined by the base branch of the pull request.
Consistency: This behavior ensures that the tests and checks run on the pull request are consistent with what will be in place after the merge is completed.
Security: Running the workflow from the base branch also prevents potential security issues that could arise from running untrusted code from the head branch of external pull requests.
Best Practices
To maintain consistency across your repository:
Keep your workflow files synchronized between branches, especially for long-lived feature branches.
Use version pinning for actions to ensure reproducibility across different branches.
Regularly update your branches to incorporate the latest workflow changes from the default branch.
By understanding this behavior, you can better manage your GitHub Actions workflows and ensure they run as expected across different pull requests and branches in your repository.
This will need to be a hotfix, to merge into both "master" and "SharedDevelopment". See next comment for (lengthy, of course) LLM explanation.
The text was updated successfully, but these errors were encountered: