Slack Integration
Using Slack + Codecov allows you to create notifications for code coverage data and changes directly into channels of your choosing.
Getting started
The first step to integrating Codecov with Slack is to download the Slack app here: https://notifications.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.
Parameter | Examples | Note |
---|---|---|
active | active=true active=false | Pull repositories in Codecov that are active, inactive or all (when left null) |
author | author=exampleName | Specify author of a branch |
base | base=exampleCommitSHA | Specify what base to use in a comparison (use in conjunction with head) |
branch | branch=exampleBranch | Specify what branch to pull data from |
commit_id | commit_id=fullExampleCommitSHA | |
component_id | component_id=exampleComponent | Specify what component to pull data from |
end_date | end_date=YYYY-MM-DD | [Flag specific] Specify the end of a time period from which to pull data (used with start_date) |
flag | flag=exampleFlag | Specify what flag to pull data from |
head | head=exampleCommitsSHA | Specify what head commit to use in a comparison (use in conjunction with base) |
interval | interval=1d interval=7d interval=30d | [Flag specific] Specify the size of bucket for flags data |
is_admin | is_admin=true is_admin=false | [User specific] Specify to pull all users, non admins, or only admins |
names | names=exampleRepo | [Repo specific] Name of a repo |
ordering | ordering=Branchname Updatestamp | [Branch specific] Specify to sort on Branchname or Updatestamp |
page | page=# | How many "pages" to show |
page_size | page_size=# | How many results to show per "page" |
path | path=/example/file/path | The file path you want to pull coverage data for |
pullid | pullid=#### | The pull id you want to pull coverage data for |
repository | repository=exampleRepository | Name of a repo |
service | service=github servicegitlab service=bitbucket | The name of the service your code is hosted on |
sha | sha=fullExampleCommitSHA | The Commit SHA of a commit you want to compare |
start_date | start_date=YYYY-MM-DD | [Flag specific] Specify the beginning of a time period from which to pull data (used with end_date) |
state | state=open state=closed state=merged | [Pulls specific] The status of the PRs you're looking to see |
username | username=codecov | This is the name of the organization you're looking to pull info from |
Current commands
Type | Command | Optional Params | Response |
---|---|---|---|
Auth | /codecov login | N/A | Authenticate to Codecov |
Auth | /codecov logout | N/A | Remove 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/A | Get 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/A | Get commit info |
Comparison | /codecov compare username=<owner_username> service=<service> repository=<repository> | N/A | Get a comparison between two commits or a pull and its base |
Comparison | /codecov compare-component username=<owner_username> service=<service> repository=<repository> | N/A | Gets a component comparison |
Comparison | /codecov compare-file username=<owner_username> service=<service> repository=<repository> path=<path> | N/A | Gets a comparison for a specific file path |
Comparison | /codecov compare-flag username=<owner_username> service=<service> repository=<repository> | N/AA | Get 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/A | Gets 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/A | Direct Notifications for a specific repo to a specific channel |
Notifications | /codecov notify-off username=<owner_username> service=<service> repository=<repository> | N/A | Turn 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/A | Get 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/A | Get repo information |
Repositories | /codecov repo-config username=<owner_username> service=<service> repository=<repository> | N/A | Get the repository configuration for the specified owner and repository |
Users | /codecov organizations | N/A | Get a list of organizations that user has access to |
Users | /codecov owner username=<owner_username> service=<service> | N/A | Get 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 |
Updated 7 months ago