158/merge by @renovate[bot] auto go mod #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: auto go mod | |
run-name: ${{ github.ref_name }} by @${{ github.actor }} ${{ github.workflow }} | |
on: | |
pull_request: | |
types: | |
- opened | |
jobs: | |
mod: | |
runs-on: ubuntu-22.04 | |
if: "startsWith( github.head_ref , 'renovate')" | |
steps: | |
- name: Generate token | |
id: generate-token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.BOT_GITHUB_APP_ID }} | |
private_key: ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }} | |
- name: Add PR label | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: gh pr edit "${PR_URL}" --add-label "renovate" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Go mod tidy | |
run: go mod tidy | |
- name: Go mod vendor | |
run: go mod vendor | |
- name: Git commit and push | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git status --porcelain | |
msg=$(git log -1 --pretty=format:"%s") | |
name=$(git log -1 --pretty=format:"%an") | |
email=$(git log -1 --pretty=format:"%ae") | |
git config --global credential.helper 'github-apps -privatekey ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }} -appid ${{ secrets.BOT_GITHUB_APP_ID }} -login ${{ github.repository_owner }}' | |
git config user.name ${name} | |
git config user.email ${email} | |
git add . | |
git commit -m "${msg}" | |
git push | |
else | |
echo "no changes"; | |
fi |