-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
70 lines (70 loc) · 2.49 KB
/
action.yml
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
69
70
name: 'dependabot-changesets'
description: 'Autogenerate changesets for dependabot pull requests'
author: 'Philip Harrison <[email protected]>'
branding:
icon: "edit"
color: "blue"
on: [pull_request]
inputs:
github-token:
required: false
default: "${{ github.token }}"
commit_message:
description: Commit message
required: false
default: Add changeset for dependabot updates
branch:
description: Git branch name, where changes should be pushed too. Required if Action is used on the `pull_request` event
required: false
default: "${{ github.head_ref }}"
repository:
description: Local file path to the git repository. Defaults to the current directory (`.`)
required: false
default: "${{ github.repository }}"
commit_user_name:
description: Name used for the commit user
required: false
default: github-actions[bot]
commit_user_email:
description: Email address used for the commit user
required: false
default: 41898282+github-actions[bot]@users.noreply.github.com
default_semver_update_type:
description: Default semver type for dependabot updates
required: false
default: 'patch'
runs:
using: "composite"
steps:
- run: echo $GITHUB_WORKSPACE
shell: bash
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
with:
repository: "${{ inputs.repository }}"
ref: "${{ inputs.branch }}"
token: "${{ inputs.github-token }}"
fetch-depth: "0"
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: 16
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@4de7a6c08ce727a42e0adbbdc345f761a01240ce # v1
with:
github-token: "${{ inputs.github-token }}"
- run: node "${{ github.action_path }}/dist/index.js"
shell: bash
env:
DEPENDABOT_METADATA: '${{ steps.dependabot-metadata.outputs.updated-dependencies-json }}'
DEFAULT_SEMVER_UPDATE_TYPE: '${{ inputs.default_semver_update_type }}'
- run: |
git config --local user.name "${{ inputs.commit_user_name }}"
git config --local user.email "${{ inputs.commit_user_email }}"
git add .changeset
if ! git diff-index --quiet HEAD; then
git commit --signoff -m "${{ inputs.commit_message }}"
git push --set-upstream origin "HEAD:${{ inputs.branch }}"
else
echo "Found no changes to commit"
fi
shell: bash