"Workflow file for this run" shows config different from actual execution #181055
Replies: 4 comments 6 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hey! This is actually a common point of confusion with GitHub Actions, and it's caught me off guard a few times too. What's happening: When you trigger a workflow on a PR, GitHub Actions uses the workflow file from the base branch (usually main or develop), not from your feature branch. So even though your feature branch might have an older version of the workflow file, the actual execution is running with the updated workflow from the default branch. Why it works this way: This is by design for security reasons. If workflows ran from the PR branch, someone could open a malicious PR that modifies the workflow to steal secrets or do other nasty stuff. By running the workflow from the base branch, repo maintainers stay protected. The confusing part: The "Workflow file for this run" button shows you the file from your feature branch (where the code lives), but the actual execution uses the workflow from the base branch. That's why you're seeing jobs that aren't in the file you're looking at. How to fix the confusion: Merge or rebase - Update your feature branch with the latest from the default branch. This will sync up the workflow files. Check the base branch - Look at the workflow file in your default branch (like main). That's what's actually running. Use the right view - In the Actions tab, you can see which commit the workflow actually ran from. It should point to the base branch commit. Quick example: Your feature branch: workflow.yml (no "deploy" job) |
BetaWas this translation helpful?Give feedback.
-
Great question! Honestly, this tripped me up too when I first encountered it. That "Workflow file for this run" button feels like it's showing you what actually ran... but it's actually showing what you wanted to run. The Short Answer Why It Works This Way yaml
yaml
The Documentation Proof "When you create a pull request, GitHub Actions runs the workflows from the base branch, not the head branch." From: Triggering a workflow The button shows your feature branch file because: It's convenient - you can click to edit the file you're actually working on It shows intent - you can see what changes you're proposing It's consistent - all file links in PRs show the feature branch version Think of It Like This How to Test This Yourself In your main branch, create a workflow that just says: yaml yaml Why This Is Actually Good Security first - No random PR can hijack your CI/CD Predictable - You know exactly what will run (your approved workflows) Reviewable - You can see proposed workflow changes before they go live The Gotcha Moment Bottom Line Hope that helps demystify it! It's one of those GitHub Actions quirks that makes total sense once you understand the security reasoning behind it. |
BetaWas this translation helpful?Give feedback.
-
ok sir,sorry for using ai ,i was doing that to get reward(achivement) |
BetaWas this translation helpful?Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Actions Checkout
Discussion Details
A feature branch based off the default branch is now out of date with the default branch.
On the PR of this feature branch, the "Workflow file for this run" button leads me to a file that does not include a certain job. However, the side panel on the left of this file does show that this job ran, and that it failed.
Why does the "Workflow file for this run" show a certain YAML configuration, while the actual execution shows jobs that come from a different configuration?
BetaWas this translation helpful?Give feedback.
All reactions