Skip to content

Commit 68f0b8e

Browse files
authored
Merge pull request #81 from packagist/dependabot
Dependabot Step by Step Guide
2 parents 9faaf10 + 4e05088 commit 68f0b8e

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed
129 KB
Loading
35.1 KB
Loading
35.5 KB
Loading
62.3 KB
Loading
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Set up Dependabot with Private Packagist
2+
##
3+
4+
[Dependabot](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide) informs you about vulnerabilities in the dependencies that you use in your repository and can automatically raise pull requests to keep your dependencies up-to-date.
5+
6+
This guide explains how to configure and set up Dependabot if you want to use it with [Private Packagist](https://packagist.com).
7+
8+
9+
## Enable Dependabot in GitHub
10+
11+
Start in your GitHub repository and go to “Settings”. In the “Security” section of the sidebar go to “Code security and analysis”, where you can enable Dependabot. In this process, you will create a dependabot.yaml [as shown as below](#dependabotyaml). Follow [this guide on GitHub](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide#enabling-dependabot-for-your-repository) for the complete steps to enable Dependabot.
12+
13+
![enable dependabot](/Resources/public/img/docs/articles/dependabot-secret.png)
14+
15+
When you click on configure, the dependabot.yaml will be created for you in the .github folder.
16+
17+
### dependabot.yaml
18+
19+
A minimal Dependabot config file would look like this:
20+
21+
```yaml
22+
version: 2
23+
updates:
24+
- package-ecosystem: "composer"
25+
directory: "/"
26+
registries:
27+
- private_packagist
28+
schedule:
29+
interval: "weekly"
30+
registries:
31+
private_packagist:
32+
type: composer-repository
33+
url: https://repo.packagist.com/acme/
34+
username: token
35+
password: ${{secrets.PRIVATE_PACKAGIST_AUTH_TOKEN}}
36+
```
37+
38+
Replace the Composer URL `https://repo.packagist.com/acme/` with your organization's Composer URL on packagist.com. The example URL is for the organization named `acme`.
39+
40+
To grant Dependabot access to the packages on Private Packagist, you need to provide the secret `PRIVATE_PACKAGIST_AUTH_TOKEN` to your GitHub repository. In Settings, under the section “Security,” there is a “Secrets and Variables” page for Dependabot.
41+
42+
![Dependabot Secrets](/Resources/public/img/docs/articles/dependabot-secret.png)
43+
44+
Now, on Private Packagist, create an authentication token with update access under “Settings” and “Authentication Tokens”. Copy the secret token into the GitHub form.
45+
46+
## Troubleshooting
47+
48+
To check if Dependabot is able to access your packages, navigate to “Insights” on your GitHub repository, then “Dependency Graph” and then activate the tab “Dependabot”.
49+
50+
![Dependabot Insights](/Resources/public/img/docs/articles/dependabot-insights.png)
51+
52+
There is a link “Recent update jobs”, that will show the last jobs from Dependabot and logs. The last job should be green now.
53+
54+
![Dependabot Jobs](/Resources/public/img/docs/articles/dependabot-jobs.png)
55+
56+
Make sure that:
57+
- the secret name matches the one that you referenced in dependabot.yaml
58+
- the Private Packagist authentication token is still valid and has not expired.
59+
- the names under `updates[x].registries` are matching a key for credentials in `registries` on the top level of the [dependabot.yaml](#dependabotyaml).

0 commit comments

Comments
 (0)