Skip to content

fix ci

fix ci #3

name: Dependabot auto-merge
on: pull_request
permissions:
contents: read
jobs:
docker-build:
name: Build and test
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' || github.event.action == 'synchronize' && startsWith( github.head_ref, 'dependabot' ) }}
env:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ github.repository }}:${{ github.sha }}
${{ github.repository }}:latest
- name: Build and push for test branch
if: github.ref == 'refs/heads/test'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ github.repository }}:${{ github.sha }}
${{ github.repository }}:test
- name: Run tests
run: |
docker pull ${{ github.repository }}:${{ github.sha }}
docker run --rm ${{ github.repository }}:${{ github.sha }} --exchanges kucoin kraken --symbols BTC/USDT ETH/USDT
dependabot:
runs-on: ubuntu-latest
permissions: write-all
needs: docker-build
if: ${{ github.actor == 'dependabot[bot]' || github.event.action == 'synchronize' && startsWith( github.head_ref, 'dependabot' ) }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve and enable auto-merge for Dependabot PRs
if: |
${{ ( steps.metadata.outputs.package-ecosystem == 'hex' && steps.metadata.outputs.update-type == 'version-update:semver-patch' ) || steps.metadata.outputs.package-ecosystem == 'github-actions' }}
run: |
gh pr review --approve "$PR_URL"
gh pr edit "$PR_URL" -t "(auto merged) $PR_TITLE"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
PR_TITLE: ${{ github.event.pull_request.title }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}