I am trying to write a GitHub App that manages deployments for my projects. This includes triggering a deployment via a requested action to fill in for the lack of manual triggers.
Once a deployment is created GitHub Actions will run the deployment workflow and I can query the API to obtain the status of workflow runs and check runs. However I can only see that a workflow run was triggered by a deployment and not which deployment it relates to. As far as I am aware there is no way to associate a GitHub Actions check/workflow run with the event that triggered it.
This means that if I were to trigger deployments to multiple environments then I would be unable to tell which run was created for which deployment. I am therefore unable to update the status of the deployment without a deployment status action in the workflow. If the workflow file was invalid or GitHub Actions had an outage then my deployment status would be in limbo without manual intervention.
Is there any way to easily correlate a deployment with the workflow it triggers? I am sceptical of basing everything off of timestamps but it appears that it might be the way to go.