Repository navigation
68 lines (63 loc) · 3.15 KB
/
Copy pathdependabot-automerge.yml
File metadata and controls
68 lines (63 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Dependabot auto-merge
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: read
jobs:
metadata:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
with:
github-token: ${{ github.token }}
- name: Write metadata artifact
env:
OUTPUT_PATH: ${{ runner.temp }}/dependabot-automerge-metadata.json
REPOSITORY: ${{ github.repository }}
REPOSITORY_ID: ${{ github.repository_id }}
WORKFLOW_RUN_ID: ${{ github.run_id }}
WORKFLOW_RUN_ATTEMPT: ${{ github.run_attempt }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_ID: ${{ github.event.pull_request.id }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }}
BASE_REPO_ID: ${{ github.event.pull_request.base.repo.id }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
HEAD_REPO_ID: ${{ github.event.pull_request.head.repo.id }}
PR_USER: ${{ github.event.pull_request.user.login }}
UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }}
UPDATED_DEPENDENCIES_JSON: ${{ steps.metadata.outputs.updated-dependencies-json }}
MAINTAINER_CHANGES: ${{ steps.metadata.outputs.maintainer-changes }}
run: |
set -euo pipefail
jq -n \
--arg schema 'dependabot-automerge/v2' \
--arg repository "$REPOSITORY" \
--argjson repositoryId "$REPOSITORY_ID" \
--argjson workflowRunId "$WORKFLOW_RUN_ID" \
--argjson workflowRunAttempt "$WORKFLOW_RUN_ATTEMPT" \
--argjson prNumber "$PR_NUMBER" \
--argjson prId "$PR_ID" \
--arg headSha "$HEAD_SHA" \
--arg baseRepo "$BASE_REPO" \
--argjson baseRepoId "$BASE_REPO_ID" \
--arg headRepo "$HEAD_REPO" \
--argjson headRepoId "$HEAD_REPO_ID" \
--arg prUser "$PR_USER" \
--arg updateType "$UPDATE_TYPE" \
--arg updatedDependenciesJson "$UPDATED_DEPENDENCIES_JSON" \
--arg maintainerChanges "$MAINTAINER_CHANGES" \
'{schema: $schema, repository: $repository, repositoryId: $repositoryId, workflowRunId: $workflowRunId, workflowRunAttempt: $workflowRunAttempt, prNumber: $prNumber, prId: $prId, headSha: $headSha, baseRepo: $baseRepo, baseRepoId: $baseRepoId, headRepo: $headRepo, headRepoId: $headRepoId, prUser: $prUser, updateType: $updateType, updatedDependenciesJson: $updatedDependenciesJson, maintainerChanges: $maintainerChanges}' \
> "$OUTPUT_PATH"
- name: Upload metadata artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dependabot-automerge-metadata
path: ${{ runner.temp }}/dependabot-automerge-metadata.json
if-no-files-found: error
retention-days: 1