Skip to content

Commit 6bad9c3

Browse files
authored
Merge pull request #16 from Shopify/add-dependabot-golang-support
support golang in dependabot automerge
2 parents be347ff + 0e9cc6d commit 6bad9c3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/dependabot-automerge.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ on:
2626
default: none
2727
description: |
2828
GitHub Actions upgrades to automatically merge. Valid values are: all, none, major, minor, patch.
29+
gomod:
30+
required: false
31+
type: string
32+
default: none
33+
description: |
34+
Go upgrades to automatically merge. Valid values are: all, none, major, minor, patch.
2935
npm:
3036
required: false
3137
type: string
@@ -57,6 +63,12 @@ jobs:
5763
exit 1
5864
fi
5965
66+
echo "gomod=${{ inputs.gomod }}"
67+
if [[ ! "${{ inputs.gomod }}" =~ ^(all|none|major|minor|patch)$ ]]; then
68+
echo "Invalid input: gomod=${{ inputs.gomod }}"
69+
exit 1
70+
fi
71+
6072
echo "npm=${{ inputs.npm }}"
6173
if [[ ! "${{ inputs.npm }}" =~ ^(all|none|major|minor|patch)$ ]]; then
6274
echo "Invalid input: npm=${{ inputs.npm }}"
@@ -130,3 +142,34 @@ jobs:
130142
run: |
131143
gh pr review --approve --body "Merging this \`${UPDATE_TYPE}\` update (npm: \`${MERGE_ECOSYSTEM}\`, all: \`${MERGE_ALL}\`)" "$PR_URL"
132144
gh pr merge --auto --merge "$PR_URL"
145+
146+
- name: Merge Go update
147+
if: |
148+
steps.metadata.outputs.package-ecosystem == 'go_modules' &&
149+
(
150+
(inputs.all == 'all' || inputs.go_modules == 'all') ||
151+
(
152+
steps.metadata.outputs.update-type == 'version-update:semver-major' &&
153+
(inputs.all == 'major' || inputs.go_modules == 'major')
154+
) ||
155+
(
156+
steps.metadata.outputs.update-type == 'version-update:semver-minor' &&
157+
(
158+
(inputs.all == 'major' || inputs.go_modules == 'major') ||
159+
(inputs.all == 'minor' || inputs.go_modules == 'minor')
160+
)
161+
) ||
162+
(
163+
steps.metadata.outputs.update-type == 'version-update:semver-patch' &&
164+
(inputs.all != 'none' || inputs.go_modules != 'none')
165+
)
166+
)
167+
env:
168+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169+
MERGE_ALL: ${{ inputs.all }}
170+
MERGE_ECOSYSTEM: ${{ inputs.gomod }}
171+
UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }}
172+
PR_URL: ${{ github.event.pull_request.html_url }}
173+
run: |
174+
gh pr review --approve --body "Merging this \`${UPDATE_TYPE}\` update (gomod: \`${MERGE_ECOSYSTEM}\`, all: \`${MERGE_ALL}\`)" "$PR_URL"
175+
gh pr merge --auto --merge "$PR_URL"

0 commit comments

Comments
 (0)