fazizsoltani opened a new issue, #8654:
URL: https://github.com/apache/incubator-devlake/issues/8654

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   **Summary**
   The DevLake GitHub plugin currently uses the inactive deployment status 
timestamp when calculating the deployment time, which is incorrect for 
determining when the deployment was actually completed.
   **Problem Explanation**
   In GitHub's deployment lifecycle, a previous deployment is often marked 
inactive when a newer deployment succeeds and supersedes it. This transition to 
inactive can happen hours or even days after the initial, successful deployment 
occurred. When DevLake uses the inactive timestamp as the completion time, the 
resulting metrics (such as PR Deploy Time) become inaccurate.
   The following GitHub API output illustrates the issue:
   
   `
   gh api "repos/company/repo/deployments/3361340000/statuses" --jq '.[] | 
{state: .state, created_at: .created_at}'
   {
     "created_at": "2025-11-25T11:17:42Z",
     "state": "inactive"
   }
   {
     "created_at": "2025-11-24T12:51:13Z",
     "state": "success"
   }
   {
     "created_at": "2025-11-24T12:49:25Z",
     "state": "in_progress"
   }
   {
     "created_at": "2025-11-24T12:49:19Z",
     "state": "queued"
   }
   {
     "created_at": "2025-11-24T12:47:57Z",
     "state": "waiting"
   }
   `
   
   ### What do you expect to happen
   
   The actual deployment finished on 2025-11-24T12:51:13Z (the success status 
time). However, the time being recorded in the DevLake database is the inactive 
timestamp: 2025-11-25T11:17:42Z.
   
   DevLake should use the timestamp corresponding to the final success status, 
not the later inactive status, to accurately calculate deployment duration.
   
   ### How to reproduce
   
   To reproduce the bug, simply create a deployment targeting a specific 
environment (like production), which will subsequently achieve a success 
status. Then, after a period of time, add a new commit and trigger a second 
deployment to that same environment. This second action will automatically 
cause GitHub to mark the initial, successful deployment as inactive; a 
documented behavior (see [GitHub inactive deployments 
documentation](https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#inactive-deployments)).
 
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v1.0.3-beta8
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to