Skip to content
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

Status Check war reseted after Commit #586

Closed
ernestoguimaraes opened this issue Nov 28, 2023 · 6 comments
Closed

Status Check war reseted after Commit #586

ernestoguimaraes opened this issue Nov 28, 2023 · 6 comments
Labels
status: pending More info is needed before deciding what to do status: stale Inactive issues and PRs

Comments

@ernestoguimaraes
Copy link

I have some Workflows that show up on Status Check during my CI. This is the Flow:

Push to my Branch - Triggers an Snapshot
on:
push:
branches-ignore:
- 'main'

Opening a PR to Main. Triggers another workflow:
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]

The problems happens when I open the PR. I´m able to see all jobs from SNAPSHOT and the workflow that is running at the moment. During these steps, I need to make a change in one file and upload it back to the Branch, creating a Tag as information

When the workflow starts the EndBug/add-and-commit@v9 action. It commits my code as expected and does not trigger any workflow again (the Push triggers) and this is what I expect

However, when I come back to PR, I noticed that all my Status Check resets. No more Log information about it.

I tried to commit the application repo with a GitHub App token and the same behavior happened.

Have you seen this?

@ernestoguimaraes ernestoguimaraes added the status: pending More info is needed before deciding what to do label Nov 28, 2023
@EndBug
Copy link
Owner

EndBug commented Nov 29, 2023

This is intended behavior on GitHub's part: PR status checks always refer to the latest commit, so if you don't re-trigger CI on the automated commit it won't display any status checks

That's because otherwise an action could break your code and the status checks would still be successful

You need to either commit using a PAT, or re-trigger some the status checks you need either manually or via a workflow dispatch call to the API

@ernestoguimaraes
Copy link
Author

Hey @EndBug ! thank you.

But one question:; I was testing with my friend yesterday. in the same scenario, If I ask him to Update the Branch, the status is not reset. The reset problem happens using GITHUB_TOKEN and now a GitHub App Token. The PAT is an option, however, using in a enterprise scenario, I will reach the PAT Threshold very fast.

@EndBug
Copy link
Owner

EndBug commented Nov 29, 2023

Maybe if you update the branch using the GitHub UI they just keep the previous result, since they "trust" the operation. I don't know exactly what the criteria is though 🙌🏻

I would suggest you allow your "test" workflows, the ones you require the status checks to be run for, to be run via workflow dispatches, then add a step using some action to send the dispatch via the GitHub API
There are a few actions on the marketplace you can use for that, this is one of them: https://github.com/marketplace/actions/workflow-dispatch

@ernestoguimaraes
Copy link
Author

I was making some tests here and noticed something.
Before my workflow starts, my PR is attached to a commti Hash. As a need to make a Branch commit, It´s creating a new Hash.
Is there a way to make a commit and preserve the original Hash? I believe it´s Fast-Foward, right?

@EndBug
Copy link
Owner

EndBug commented Nov 29, 2023

I don't think it's possible, because the SHA of each commit is generated by git internals by hashing different info about the commit, including the SHA of the parent.
That makes it impossible to insert a commit in the history without modifying every commit down the line.
Even with fast-forward merges or rebases, the SHA of every subsequent commit is re-calcultated.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the status: stale Inactive issues and PRs label Dec 20, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending More info is needed before deciding what to do status: stale Inactive issues and PRs
Projects
None yet
Development

No branches or pull requests

2 participants