Slack Integration

Using Slack + Codecov allows you to create notifications for code coverage data and changes directly into channels of your choosing.

Example Slack Notification from Codecov

Example Slack Notification from Codecov

Getting started

The first step to integrating Codecov with Slack is to download the Slack app here: https://slack.codecov.io/slack/install.

Once you have installed the app, you will need to authenticate from Slack to your code host. You can do this by typing /codecov login.

You can also logout using /codecov logout.

Interacting with the app

All commands are given using slash commands in Slack's message editor.

All commands can be found by typing /codecov help - using this will enable you to dive in without having to split screen between these docs and your Slack instance.

There's a variety of different parameters you can pass Codecov, these parameters allow you to fine tune the response you receive to exactly what you're looking for. The table below uses the Codecov org in Github as the example with aj-codecov as a user.

ParameterExamplesNote
activeactive=true active=falsePull repositories in Codecov that are active, inactive or all (when left null)
authorauthor=exampleNameSpecify author of a branch
basebase=exampleCommitSHASpecify what base to use in a comparison (use in conjunction with head)
branchbranch=exampleBranchSpecify what branch to pull data from
commit_idcommit_id=fullExampleCommitSHA
component_idcomponent_id=exampleComponentSpecify what component to pull data from
end_dateend_date=YYYY-MM-DD[Flag specific] Specify the end of a time period from which to pull data (used with start_date)
flagflag=exampleFlagSpecify what flag to pull data from
headhead=exampleCommitsSHASpecify what head commit to use in a comparison (use in conjunction with base)
intervalinterval=1d interval=7d interval=30d[Flag specific] Specify the size of bucket for flags data
is_adminis_admin=true is_admin=false[User specific] Specify to pull all users, non admins, or only admins
namesnames=exampleRepo[Repo specific] Name of a repo
orderingordering=Branchname Updatestamp[Branch specific] Specify to sort on Branchname or Updatestamp
pagepage=#How many "pages" to show
page_sizepage_size=#How many results to show per "page"
pathpath=/example/file/pathThe file path you want to pull coverage data for
pullidpullid=####The pull id you want to pull coverage data for
repositoryrepository=exampleRepositoryName of a repo
serviceservice=github servicegitlab service=bitbucketThe name of the service your code is hosted on
shasha=fullExampleCommitSHAThe Commit SHA of a commit you want to compare
start_datestart_date=YYYY-MM-DD[Flag specific] Specify the beginning of a time period from which to pull data (used with end_date)
statestate=open state=closed state=merged[Pulls specific] The status of the PRs you're looking to see
usernameusername=codecovThis is the name of the organization you're looking to pull info from

Current commands

TypeCommandOptional ParamsResponse
Auth/codecov loginN/AAuthenticate to Codecov
Auth/codecov logoutN/ARemove authentication from Codecov
Branches/codecov branches username=<owner_username> service=<service> repository=<repository>ordering=<ordering> author=<author> page=<page> page_size=<page_size>Get a list of branches for the repository
Branches/codecov branch repository=<repository> username=<owner_username> service=<service> branch=<branch>N/AGet specific branch information
Commits/codecov commits username=<owner_username> service=<service> repository=<repository>branch=<branch> page=<page> page_size=<page_size>Get a list of commits for the repository
Commits/codecov commit repository=<repository> username=<owner_username> service=<service> commitid=<commitid>N/AGet commit info
Comparison/codecov compare username=<owner_username> service=<service> repository=<repository>N/AGet a comparison between two commits or a pull and its base
Comparison/codecov compare-component username=<owner_username> service=<service> repository=<repository>N/AGets a component comparison
Comparison/codecov compare-file username=<owner_username> service=<service> repository=<repository> path=<path>N/AGets a comparison for a specific file path
Comparison/codecov compare-flag username=<owner_username> service=<service> repository=<repository>N/AAGet a flag comparison
Components/codecov components username=<owner_username> service=<service> repository=<repository>branch=<branch> sha-<sha>Gets a list of components for the specified repository
Coverage/codecov coverage-trend username=<owner_username> service=<service> repository=<repository>branch=<branch> end_date=<end_date> start_date=<start_date> interval=<1d,30d,7d> page=<page> page_size=<page_size>Get a paginated list of timeseries measurements aggregated by the specified interval
Coverage/codecov file-coverage-report repository=<repository> username=<owner_username> service=<service> path=<path>branch=<branch> sha=<sha>Get coverage info for a single file specified by path
Coverage/codecov commit-coverage-report repository=<repository> username=<owner_username> service=<service>path=<path> branch=<branch> sha=<sha> component_id=<component_id> flag=<flag>Get line-by-line coverage info (hit=0/miss=1/partial=2)
Coverage/codecov commit-coverage-totals repository=<repository> username=<owner_username> service=<service> path=<path>path=<path> branch=<branch> sha=<sha> component_id=<component_id> flag=<flag>Get the coverage totals for a given commit and the coverage totals broken down by file
Flags/codecov flags username=<owner_username> service=<service> repository=<repository> Optional params: page=<page> page_size=<page_size>N/AGets a paginated list of flags for the specified repository
Flags/codecov coverage-trends username=<owner_username> service=<service> repository=<repository> flag=<flag>page=<page> page_size=<page_size> start_date=<start_date> end_date=<end_date> branch=<branch> interval=<1d,30d,7d>Gets a paginated list of timeseries measurements aggregated by the specified
Notifications/codecov notify username=<owner_username> service=<service> repository=<repository>N/ADirect Notifications for a specific repo to a specific channel
Notifications/codecov notify-off username=<owner_username> service=<service> repository=<repository>N/ATurn off Notifications for a specific repo in a specific channel
Pulls/codecov pulls username=<owner_username> service=<service> repository=<repository>ordering=<ordering> page=<page> page_size=<page_size> state=<closed,open,merged>Get a list of pulls for the repository
Pulls/codecov pull repository=<repository> username=<owner_username> service=<service> pullid=<pullid>N/AGet pull information
Repositories/codecov repos username=<owner_username> service=<service>names=<names> active=<active> page=<page> page_size=<page_size>Get a list of repos for the specified owner
Repositories/codecov repo repository=<repository> username=<owner_username> service=<service>N/AGet repo information
Repositories/codecov repo-config username=<owner_username> service=<service> repository=<repository>N/AGet the repository configuration for the specified owner and repository
Users/codecov organizationsN/AGet a list of organizations that user has access to
Users/codecov owner username=<owner_username> service=<service>N/AGet owner's information
Users/codecov users username=<owner_username> service=<service>is_admin=<is_admin> activated=<activated> page=<page> page_size=<page_size>Get a list of users for the specified owner