converter: Optimize code #84
Workflow file for this run
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: Dependabot | |
on: | |
pull_request_target: | |
jobs: | |
test: | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ windows-latest, ubuntu-latest, macos-latest ] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
- name: Test Code | |
id: test | |
run: | | |
go build -v ./... | |
go test -v -race ./... | |
cd converter | |
go mod tidy | |
go build -v ./... | |
go clean | |
cd .. | |
git config user.name "GitHub Actions" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git diff-index --quiet HEAD || echo "new_data=1" >> $GITHUB_OUTPUT | |
echo "date=$(TZ=PRC date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Commit | |
if: steps.test.outputs.new_data == 1 | |
run: | | |
git commit -m ${{ steps.test.outputs.date }} | |
git push | |
merge: | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
needs: test | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 60 | |
max_attempts: 5 | |
retry_wait_seconds: 60 | |
retry_on: error | |
command: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |