Explore git repositories from within Salesforce.
This application comes with out-of-the-box support for repositories hosted on:
- Github
- Bitbucket
- Gitlab
For now it supports the following actions:
- List available repositories for a user / group / team.
- Explore file tree of a selected repository.
- View a specific file's content.
After authenticating your hosting service you should be good to go.
You should add the Repo Explorer
permission set to your user and navigate to the Repo Explorer
Lightning App to see a demo. You should modify the Lightning Page to change the GitRepoList
component's attributes to specify what you really want to explore.
Before using the supplied Lightning Component you must first authenticate your org with the Hosting Service you want to use.
You'll need to configure the appropriate Auth. Providers to use a valid client id
and client secret
(refer to the Resources section for more info on how to create an application for each service to obtain this values).
- Proceed to
Setup > Identity > Auth. Providers
. - Click
Edit
next to the Auth. Provider you want to use. - Change the
Consumer Key
andConsumer Secret
with the correspondingclient id
andclient secret
from the application you created in your hosting service. - In the Auth. Provider detail page you'll see a
Callback URL
, make sure you use that one when configuring your hosting service application.
Once we have a valid Auth. Provider we can then proceed to authenticate a user so our component can integrate with the hosting service in an authenticated fashion.
- Proceed to
Setup > Security > Named Credentials
. - Click
Edit
next to the Named Credential you want to use. - The
Authentication Status
should showPending
. - Make sure the
Start Authentication Flow on Save
checkbox is checked. - Click
Save
. - A popup with the hosting service login and authorization request would be presented.
- After authorization the Named Credential
Authentication Status
should showAuthenticated
.
If you encounter issues in this step, make sure you've configured correctly the application in you hosting service with the right scopes and callback url.
In case you want to use other hosting service that's not listed in the supported ones, you'll need to follow this steps:
- Create an Auth. Provider for your hosting service.
- Create a Named Credential related to your Auth. Provider and authenticate it.
- Create an apex class extending from the
GitHostingService
class and implement the required methods. - Create a new entry in the
Git Hosting Service
custom metadata with the appropiate information from the hosting service you're creating.
If you think others in the community could benefit from this new hosting service configuration, please make a pull request and contribute it (make sure to not include your Auth. Provider client id
and client secret
).
Here you can find some information on how to create an application in the supported hosting services so you can link it to the Auth. Provider.
Remember to use the callback URL supplied by the Auth. Provider configuration.
- Make sure you have sfdx installed.
- Fork this repo.
- Clone your fork to your machine.
- Spin up a scratch org:
sfdx force:org:create -s -a RepoExplorer -v DevHub -f config/project-scratch-def.json
.
- Push source to the scratch org:
sfdx force:source:push
- Make your changes and get crazy!
- According to the current Metadata Coverage Report, Auth. Providers can be included in Unlocked Packages, but only ones without a namespaces; therefore this package cannot have a namespace for now.