Skip to content

Use RunE instead of Run for cobra commands #3580

Use RunE instead of Run for cobra commands

Use RunE instead of Run for cobra commands #3580

Workflow file for this run

name: Dependabot
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
update-go-package-metadata:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Detect Go version
id: runtimes
run: echo "::set-output name=golang-version::$(grep 'go [[:digit:]].[[:digit:]]*' go.work | cut -d' ' -f2)"
- name: Install Golang
uses: actions/setup-go@v4
with:
go-version: ${{ steps.runtimes.outputs.golang-version }}
- name: Update go package metadata
run: go work sync; go mod tidy
- name: Commit any changes
continue-on-error: true
run: |
git config user.name "$(git show -s --format='%aN' HEAD)"
git config user.email "$(git show -s --format='%aE' HEAD)"
git commit -a -m "Update go metadata" && git push origin HEAD:${{github.event.pull_request.head.ref}}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
enable-auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}