@@ -14,12 +14,13 @@ Extract information about the dependencies being updated by a Dependabot-generat
14
14
15
15
## Usage instructions
16
16
17
- Create a workflow file that contains a step that uses: ` dependabot/fetch-metadata@v1 ` , e.g.
17
+ Create a workflow file that contains a step that uses: ` dependabot/fetch-metadata@v2 ` , e.g.
18
18
19
19
``` yaml
20
20
-- .github/workflows/dependabot-prs.yml
21
21
name : Dependabot Pull Request
22
22
on : pull_request_target
23
+ if : ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'owner/my_repo' }}
23
24
jobs :
24
25
build :
25
26
permissions :
28
29
steps :
29
30
- name : Fetch Dependabot metadata
30
31
id : dependabot-metadata
31
- uses : dependabot/fetch-metadata@v1
32
+ uses : dependabot/fetch-metadata@v2
32
33
with :
33
34
alert-lookup : true
34
35
compat-lookup : true
@@ -109,11 +110,11 @@ jobs:
109
110
dependabot:
110
111
runs-on: ubuntu-latest
111
112
# Checking the author will prevent your Action run failing on non-Dependabot PRs
112
- if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
113
+ if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'owner/my_repo' }}
113
114
steps:
114
115
- name: Dependabot metadata
115
116
id: dependabot-metadata
116
- uses: dependabot/fetch-metadata@v1
117
+ uses: dependabot/fetch-metadata@v2
117
118
- uses: actions/checkout@v4
118
119
- name: Approve a PR if not already approved
119
120
run: |
@@ -143,11 +144,11 @@ permissions:
143
144
jobs :
144
145
dependabot :
145
146
runs-on : ubuntu-latest
146
- if : ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
147
+ if : ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'owner/my_repo' }}
147
148
steps :
148
149
- name : Dependabot metadata
149
150
id : dependabot-metadata
150
- uses : dependabot/fetch-metadata@v1
151
+ uses : dependabot/fetch-metadata@v2
151
152
- name : Enable auto-merge for Dependabot PRs
152
153
if : ${{contains(steps.dependabot-metadata.outputs.dependency-names, 'rails') && steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch'}}
153
154
run : gh pr merge --auto --merge "$PR_URL"
@@ -172,11 +173,11 @@ permissions:
172
173
jobs :
173
174
dependabot :
174
175
runs-on : ubuntu-latest
175
- if : ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
176
+ if : ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'owner/my_repo' }}
176
177
steps :
177
178
- name : Dependabot metadata
178
179
id : dependabot-metadata
179
- uses : dependabot/fetch-metadata@v1
180
+ uses : dependabot/fetch-metadata@v2
180
181
- name : Add a label for all production dependencies
181
182
if : ${{ steps.dependabot-metadata.outputs.dependency-type == 'direct:production' }}
182
183
run : gh pr edit "$PR_URL" --add-label "production"
0 commit comments