Skip to content

Commit b56371d

Browse files
authored
Merge pull request #42481 from github/repo-sync
Repo sync
2 parents baeea51 + cc4b251 commit b56371d

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

content/code-security/tutorials/secure-your-dependencies/automating-dependabot-with-github-actions.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Most automation requires you to know information about the contents of the pull
5151

5252
Example:
5353

54-
{% raw %}
54+
5555

5656
```yaml copy
5757
{% data reusables.actions.actions-not-certified-by-github-comment %}
@@ -71,15 +71,13 @@ jobs:
7171
id: metadata
7272
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
7373
with:
74-
github-token: "${{ secrets.GITHUB_TOKEN }}"
74+
github-token: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
7575
# The following properties are now available:
7676
# - steps.metadata.outputs.dependency-names
7777
# - steps.metadata.outputs.dependency-type
7878
# - steps.metadata.outputs.update-type
7979
```
8080

81-
{% endraw %}
82-
8381
For more information, see the [`dependabot/fetch-metadata`](https://github.com/dependabot/fetch-metadata) repository.
8482

8583
## Labeling a pull request
@@ -88,7 +86,7 @@ If you have other automation or triage workflows based on {% data variables.prod
8886

8987
Example that flags all production dependency updates with a label:
9088

91-
{% raw %}
89+
9290

9391
```yaml copy
9492
{% data reusables.actions.actions-not-certified-by-github-comment %}
@@ -108,23 +106,21 @@ jobs:
108106
id: metadata
109107
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
110108
with:
111-
github-token: "${{ secrets.GITHUB_TOKEN }}"
109+
github-token: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
112110
- name: Add a label for all production dependencies
113111
if: steps.metadata.outputs.dependency-type == 'direct:production'
114112
run: gh pr edit "$PR_URL" --add-label "production"
115113
env:
116-
PR_URL: ${{github.event.pull_request.html_url}}
114+
PR_URL: {% raw %}${{github.event.pull_request.html_url}}{% endraw %}
117115
```
118116
119-
{% endraw %}
120-
121117
## Automatically approving a pull request
122118
123119
You can automatically approve {% data variables.product.prodname_dependabot %} pull requests by using the {% data variables.product.prodname_cli %} in a workflow.
124120
125121
Example:
126122
127-
{% raw %}
123+
128124
129125
```yaml copy
130126
{% data reusables.actions.actions-not-certified-by-github-comment %}
@@ -143,16 +139,14 @@ jobs:
143139
id: metadata
144140
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
145141
with:
146-
github-token: "${{ secrets.GITHUB_TOKEN }}"
142+
github-token: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
147143
- name: Approve a PR
148144
run: gh pr review --approve "$PR_URL"
149145
env:
150-
PR_URL: ${{github.event.pull_request.html_url}}
151-
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
146+
PR_URL: {% raw %}${{github.event.pull_request.html_url}}{% endraw %}
147+
GH_TOKEN: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}
152148
```
153149
154-
{% endraw %}
155-
156150
## Enabling automerge on a pull request
157151
158152
If you want to allow maintainers to mark certain pull requests for automerge, you can use {% data variables.product.prodname_dotcom %}'s automerge functionality. This enables the pull request to be merged when any tests and approvals required by the branch protection rules are successfully met.
@@ -161,7 +155,6 @@ For more information, see [AUTOTITLE](/pull-requests/collaborating-with-pull-req
161155
162156
You can instead use {% data variables.product.prodname_actions %} and the {% data variables.product.prodname_cli %}. Here is an example that automerges all patch updates to `my-dependency`:
163157

164-
{% raw %}
165158

166159
```yaml copy
167160
{% data reusables.actions.actions-not-certified-by-github-comment %}
@@ -181,17 +174,15 @@ jobs:
181174
id: metadata
182175
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
183176
with:
184-
github-token: "${{ secrets.GITHUB_TOKEN }}"
177+
github-token: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}"
185178
- name: Enable auto-merge for Dependabot PRs
186179
if: contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'
187180
run: gh pr merge --auto --merge "$PR_URL"
188181
env:
189-
PR_URL: ${{github.event.pull_request.html_url}}
190-
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
182+
PR_URL: {% raw %}${{github.event.pull_request.html_url}}{% endraw %}
183+
GH_TOKEN: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}
191184
```
192185

193-
{% endraw %}
194-
195186
> [!NOTE]
196187
> If you use status checks to test pull requests, you should enable **Require status checks to pass before merging** for the target branch for {% data variables.product.prodname_dependabot %} pull requests. This branch protection rule ensures that pull requests are not merged unless **all the required status checks pass**. For more information, see [AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule).
197188

0 commit comments

Comments
 (0)