SRGSSR / pillarbox-apple

A next-generation reactive media playback ecosystem for Apple platforms.
https://testflight.apple.com/join/TS6ngLqf
MIT License
54 stars 8 forks source link

Fix CI pull request monitoring #168

Closed defagos closed 1 year ago

defagos commented 1 year ago

As a developer I need a working CI so that I get feedback quickly.

Acceptance criteria

Context

PRs do not seem to trigger status checks anymore. The following issue is reported in the build log:

Parameter "env.GITHUB_PULL_REQUEST_ID=%teamcity.pullRequest.number%" is not fully resolved, using as is.

Tasks

defagos commented 1 year ago

Tested with #170 which I submitted as PR, works fine. We should try a PR created by @waliid.

defagos commented 1 year ago

@waliid PRs were still not seen by TeamCity but our setup was incomplete.

Fixing build monitoring

The PR monitoring build feature we use was unable to detect Walid's PRs. Since our repository is open source, the build feature is namely configured to monitor PRs originating from members of the organization only. For this to work, though, the PR build feature must be configured with a GitHub API access token having the read:org scope, otherwise required API calls will fail with a 302, preventing the build feature from correctly detecting that the PR issuer belongs to our organization.

Remark

To test whether a token has enough privileges you can call the following with a valid user name and the token to check if a 204 is correctly returned:

curl -I \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <token>"\
 -H "X-GitHub-Api-Version: 2022-11-28" \
 https://api.github.com/orgs/SRGSSR/members/<user>

Other improvements

This is not strictly necessary, but to have TeamCity correctly match committer identities with TeamCity user accounts it is sometimes needed to register VCS usernames under the profile section. If this setup is correct for a user, clicking on Changes at the top of the user interface will reveal the commits associated with the logged in user, otherwise a blank list.

Alternatively, a user can display all changes from all users, identify their own and click on a change to bind their account with the associated committer.