Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependabot automerge #220

Merged
merged 5 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/dependabot_auto_approve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2024 Benjamin Thomas Schwertfeger
# GitHub: https://github.com/btschwertfeger
#
# Workflow that approves and merges all pull requests from the dependabot[bot]
# author.
#
# Source (May, 2024):
# - https://blog.somewhatabstract.com/2021/10/11/setting-up-dependabot-with-github-actions-to-approve-and-merge/

name: Dependabot auto-merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions kraken/nft/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def modify_auction(
"""
Modify an existing auction owned by the user

- https://docs.kraken.com/rest/#tag/NFT-Trading/operation/modifyAuction

:param auction_id: ID referencing the auction
:type auction_id: str
:param ask_price: New ask price (only for fixed price auction type),
Expand Down Expand Up @@ -183,6 +185,8 @@ def cancel_auction(
"""
Cancel an existing auction owned by the user

- https://docs.kraken.com/rest/#tag/NFT-Trading/operation/cancelAuction

:param auction_id: IDs referencing the auctions to cancel
:type auction_id: list[str]
:param otp: One time password, defaults to None
Expand Down
24 changes: 16 additions & 8 deletions tests/nft/test_nft_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from datetime import datetime, timedelta

from kraken.exceptions import (
KrakenAuctionNotOwnedByUserError,
KrakenInvalidArgumentBelowMinError,
KrakenInvalidArgumentOfferNotFoundError,
KrakenNFTNotAvailableError,
Expand Down Expand Up @@ -59,15 +58,24 @@ def test_nft_trade_create_auction(nft_auth_trade: Trade) -> None:
@pytest.mark.nft_auth()
@pytest.mark.nft_trade()
def test_nft_trade_modify_auction(nft_auth_trade: Trade) -> None:
"""Checks the ``modify_auction`` endpoint."""
"""
Checks the ``modify_auction`` endpoint.
It is sufficient here to check that the request is valid, even if the
auction is not valid.
"""

with pytest.raises(KrakenAuctionNotOwnedByUserError):
nft_auth_trade.modify_auction(
auction_id="AT2POJ-4CH3O-4TH6JH",
ask_price="0.3",
)
response = nft_auth_trade.modify_auction(
auction_id="AT2POJ-4CH3O-4TH6JH",
ask_price="0.3",
)
assert isinstance(response, dict)
assert response.get(
"error",
[],
) == ["EAPI:Invalid arguments:No auction with the provided ID"]


@pytest.mark.wip()
@pytest.mark.nft()
@pytest.mark.nft_auth()
@pytest.mark.nft_trade()
Expand All @@ -83,7 +91,7 @@ def test_nft_trade_cancel_auction(nft_auth_trade: Trade) -> None:
assert isinstance(result["statuses"][0], dict)
assert result["statuses"][0].get("id") == "AT2POJ-4CH3O-4TH6JH"
assert result["statuses"][0].get("status") == "failed"
assert result["statuses"][0].get("reason") == "no permission"
assert result["statuses"][0].get("reason") == "not found"


@pytest.mark.nft()
Expand Down
Loading