Skip to content

Commit cf0e979

Browse files
authored
Merge branch 'main' into fix-get-info-for-library
2 parents f45919f + 6b3627f commit cf0e979

13 files changed

Lines changed: 3324 additions & 1354 deletions

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

README.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
<p align="center">
2-
<img src="https://s3.eu-west-2.amazonaws.com/dependabot-images/logo-with-name-horizontal.svg?v5" alt="Dependabot" width="336">
3-
</p>
1+
<h1 align="center">
2+
<picture>
3+
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/7659/174594540-5e29e523-396a-465b-9a6e-6cab5b15a568.svg">
4+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/7659/174594559-0b3ddaa7-e75b-4f10-9dee-b51431a9fd4c.svg">
5+
<img src="https://user-images.githubusercontent.com/7659/174594540-5e29e523-396a-465b-9a6e-6cab5b15a568.svg" alt="Dependabot" width="336">
6+
</picture>
7+
</h1>
48

59
# Fetch Metadata Action
610

@@ -10,7 +14,7 @@ Extract information about the dependencies being updated by a Dependabot-generat
1014

1115
## Usage instructions
1216

13-
Create a workflow file that contains a step that uses: `dependabot/fetch-metadata@v1.3.1`, e.g.
17+
Create a workflow file that contains a step that uses: `dependabot/fetch-metadata@v1`, e.g.
1418

1519
```yaml
1620
-- .github/workflows/dependabot-prs.yml
@@ -22,7 +26,7 @@ jobs:
2226
steps:
2327
- name: Fetch Dependabot metadata
2428
id: dependabot-metadata
25-
uses: dependabot/fetch-metadata@v1.3.1
29+
uses: dependabot/fetch-metadata@v1
2630
with:
2731
alert-lookup: true
2832
compat-lookup: true
@@ -41,6 +45,9 @@ Supported inputs are:
4145
- `compat-lookup` (boolean)
4246
- If `true`, then populate the `compatibility-score` output.
4347
- Defaults to `false`
48+
- `skip-commit-verification` (boolean)
49+
- If `true`, then the action will not expect the commits to have a verification signature. **It is required to set this to 'true' in GitHub Enterprise Server**
50+
- Defaults to `false`
4451

4552
Subsequent actions will have access to the following outputs:
4653

@@ -95,7 +102,7 @@ jobs:
95102
steps:
96103
- name: Dependabot metadata
97104
id: dependabot-metadata
98-
uses: dependabot/fetch-metadata@v1.3.1
105+
uses: dependabot/fetch-metadata@v1
99106
- uses: actions/checkout@v3
100107
- name: Approve a PR if not already approved
101108
run: |
@@ -129,13 +136,13 @@ jobs:
129136
steps:
130137
- name: Dependabot metadata
131138
id: dependabot-metadata
132-
uses: dependabot/fetch-metadata@v1.3.1
139+
uses: dependabot/fetch-metadata@v1
133140
- name: Enable auto-merge for Dependabot PRs
134141
if: ${{contains(steps.dependabot-metadata.outputs.dependency-names, 'rails') && steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch'}}
135142
run: gh pr merge --auto --merge "$PR_URL"
136143
env:
137144
PR_URL: ${{github.event.pull_request.html_url}}
138-
GITHUB_TOKEN: ${{secrets.PAT_TOKEN}}
145+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
139146
```
140147
141148
### Labelling
@@ -158,11 +165,47 @@ jobs:
158165
steps:
159166
- name: Dependabot metadata
160167
id: dependabot-metadata
161-
uses: dependabot/fetch-metadata@v1.3.1
168+
uses: dependabot/fetch-metadata@v1
162169
- name: Add a label for all production dependencies
163170
if: ${{ steps.dependabot-metadata.outputs.dependency-type == 'direct:production' }}
164171
run: gh pr edit "$PR_URL" --add-label "production"
165172
env:
166173
PR_URL: ${{github.event.pull_request.html_url}}
167174
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
168175
```
176+
177+
## Notes for project maintainers:
178+
179+
<details><summary>:book: Release guide</summary>
180+
<p>
181+
182+
- Dependabot PR's:
183+
- We expect Dependabot PRs to be passing CI and have any changes to the `dist/` folder built for production dependencies
184+
- Some development dependencies may fail the `dist/` check if they modify the Typescript compilation, these should be updated manually via `npm run build`. See the [`dependabot-build`](https://github.com/dependabot/fetch-metadata/blob/main/.github/workflows/dependabot-build.yml) action for details.
185+
- Checkout and update `main`, then generate a patch release branch
186+
```bash
187+
git checkout main
188+
git pull
189+
bin/bump-version -p patch
190+
```
191+
- Generate a draft release for your new version
192+
```bash
193+
gh release create v1.X.X --generate-notes --draft
194+
> https://github.com/dependabot/fetch-metadata/releases/tag/untagged-XXXXXX
195+
```
196+
- Create a PR linking to the release notes for review
197+
```bash
198+
gh pr create --title "v1.X.X Release Notes" --body "https://github.com/dependabot/fetch-metadata/releases/tag/untagged-XXXXXX"
199+
```
200+
- Copy the release notes from the draft release to the PR description. This is optional, but looks much nicer than a bare URL.
201+
- Merge the PR after getting it reviewed
202+
- Publish the draft release found at https://github.com/dependabot/fetch-metadata/releases/tag/untagged-XXXXXX
203+
- Update the `v1` tracking tag to point to the new version
204+
```bash
205+
git fetch --all --tags
206+
git checkout v1.x.x # Check out the release tag
207+
git tag -f v1 # Force update the tracking tag
208+
git push -f --tags
209+
```
210+
</p>
211+
</details>

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
github-token:
1414
description: 'The GITHUB_TOKEN secret'
1515
default: ${{ github.token }}
16+
skip-commit-verification:
17+
type: boolean
18+
description: 'If true, the action will not expect Dependabot commits to be verified. This should be set as `true` in GHES environments.'
19+
default: false
1620
outputs:
1721
dependency-names:
1822
description: 'A comma-separated list of all package names updated.'
@@ -41,5 +45,5 @@ outputs:
4145
compatibility-score:
4246
description: 'If this PR has a known compatibility score and `compat-lookup` is `true`, this contains the compatibility score (otherwise it contains 0).'
4347
runs:
44-
using: 'node12'
48+
using: 'node16'
4549
main: 'dist/index.js'

bin/bump-version

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ fi
2222

2323
new_version=$(npm version "${patch_level}" --no-git-tag-version)
2424
git checkout -b "${new_version}"-release-notes
25-
sed -i.bak "s|dependabot/fetch-metadata@v[0-9.]*|dependabot/fetch-metadata@${new_version}|g" "README.md"
26-
rm README.md.bak
27-
git add package.json package-lock.json README.md
25+
git add package.json package-lock.json
2826
git commit -m "${new_version}"
2927

3028
echo "Branch prepared for ${new_version}"

0 commit comments

Comments
 (0)