--- title: "ADR 0061: Early client setup and skip-CI handling in the sinker" --- * Status: accepted * Code: [`pkg/adapter/sinker.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/adapter/sinker.go) ## Context `processEvent` has to decide whether a commit carries a skip-CI command before the pipeline-as-code run starts. For pushes the webhook payload normally contains the commit message; for pull requests the message is only available through the provider API, which needs credentials from a matching `Repository`. ## Decision * When an event is present, `findMatchingRepository` runs first, using `matcher.MatchEventURLRepo` with an empty namespace so all namespaces are searched. If no repository matches, the error is logged at debug level and processing continues: matching is done again later in the run. * If a repository is found, `setupClient` calls `gitclient.SetupAuthenticatedClient` (including GitHub App token scoping) for every event type. A failure here returns an error. When it is `secrets.ErrSecretNotFound` a `RepositorySecretMissing` event is emitted on the Repository. * Push events are checked by `shouldSkipPushEvent`. If the payload marks commit metadata incomplete and a repository matched, `GetCommitInfo` is called first. The code names GitLab branch creation payloads as the case that omits commits. * Pull request and merge request events call `GetCommitInfo` and check `HasSkipCommand`, only when a repository matched. * Skip-CI answers with a skipped status via `createSkipCIStatus`. If `CreateStatus` fails it logs a warning and returns nil, so the event is still handled as skipped. ## Consequences * Without a matching repository the skip check for pull requests is not performed here, and a skip command is only seen later in the run. * A lookup failure on an incomplete push aborts processing instead of continuing with partial metadata. * A provider outage while posting the skip status is visible only in the logs.