Try to fix GitHub deployments integration
On PRs with the deploy! label, GitHub keeps stating "This branch has not been deployed". So far, I blamed this problem on a GitHub limitation: I think during the implementation of the feature branch deployments I did not find a way to link a GitHub Environment to a branch from a fork. Only branches from the origin were supported. (GitHub Environment is mostly synonymous with GitHub Deployment, but not always)
However, in https://github.com/ecamp/ecamp3/deployments/activity_log there are more things that don't add up. Workflow runs seem to always add two entries there, one of which links to the CI checks on a specific commit and the other linking to a specific workflow run. But all the links on these entries don't really seem correlated: The same entry sometimes links to an old PR which has nothing to do with the linked branch nor with the linked Deployment URL:
pr2744 renovate/php-linter (#2770) ..................... [View Deployment] Deployed by @carlobeltrame 16 hours ago (Active) feature-branch renovate/php-linter (#2770) Deployed by @carlobeltrame 16 hours ago (Active)

Also, the logs of a workflow run which actually installed some update to a feature branch deployment says:
Upgrade or install deployment (pr2744, feature-branch, 79378f6e73d5c17c709e9085c8cb3a421a4d6e53)
... Create a pending GitHub deployment
Run bobheadxi/[email protected]
targeting ecamp/ecamp3
initializing new deployment for pr2744 @ refs/heads/devel
created deployment 572803290 for pr2744 @ refs/heads/devel
created deployment status 1059857748 with status "in_progress"
... Finish the GitHub deployment
Run bobheadxi/[email protected]
targeting ecamp/ecamp3
pr2744: found 3 existing deployments for env
pr2744.572803290: setting deployment (e3e02ca6a02046c1f69a3ab003290636ce7c1178) state to "inactive"
pr2744.569243758: setting deployment (7f9d02847c07d4d22fe98a807868c35fb1cbdea4) state to "inactive"
pr2744.568628802: setting deployment (201c43ec1d05611657968cbfd0781e214dbd376b) state to "inactive"
pr2744: 3 deployments updated
finishing deployment for 572803290 with status success
572803290 status set to success { statusID: 1059862552 }
To me, the line initializing new deployment for pr2744 @ refs/heads/devel sounds wrong: It should really state something like manuelmeister:feature/ui-picasso-mobile or a commit hash which is the head of PR #2744. And the fact that it's setting 3 deployments at once to inactive also seems strange, it should be at most 1 (might be the old version of the deployment which is deactivated).
I am suspecting something with the matrix build and the bobheadxi actions does not work correctly. Maybe the deployment_id which we extract from the outputs of the previous deployment step is referenced wrongly, and we might need to set a different step id for each matrix run.
E.g. id: deployment-${{ matrix.deployment.name }} and something like deployment_id: ${{ steps[join(['deployment-', matrix.deployment.name])].outputs.deployment_id }}
When I tried the deployments, i had to disable the contexts, because otherwise it would not show up. But i think this would be dangerous.
This seems to work better now:
in PR #3406
I think this was improved with https://github.com/ecamp/ecamp3/pull/3584