Skip to content

Commit 3eafec1

Browse files
authored
Merge pull request #39 from srhinos/update-ci
Update CI Runner Versions
2 parents ca84ee3 + 033aaa8 commit 3eafec1

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

.github/workflows/ci.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
name: ci
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
48

59
jobs:
610
lint:
711
runs-on: ubuntu-latest
812
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up Python 3.9
11-
uses: actions/setup-python@v2
13+
- uses: actions/checkout@v4
14+
- name: Set up Python 3.11
15+
uses: actions/setup-python@v4
1216
with:
13-
python-version: 3.9
17+
python-version: 3.11
1418
- name: Install dependencies
1519
run: |
1620
python -m pip install --upgrade pip
@@ -19,10 +23,10 @@ jobs:
1923
- name: Lint with flake8
2024
run: |
2125
# stop the build if there are Python syntax errors or undefined names
22-
flake8 primelooter.py --count --show-source --statistics
26+
flake8 . --count --show-source --statistics
2327
- name: Lint with pylint
2428
run: |
25-
pylint primelooter.py --fail-under 10 --disable=all --enable=classes --disable=W
29+
pylint . --fail-under 10 --disable=all --enable=classes --disable=W
2630
- name: Lint with black
2731
run: |
28-
black primelooter.py --check --line-length=119
32+
black . --check --line-length=119

.github/workflows/manual-release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout repository
10-
uses: actions/checkout@v2
10+
uses: actions/checkout@v4
1111

1212
- name: Set up QEMU
13-
uses: docker/setup-qemu-action@v1
13+
uses: docker/setup-qemu-action@v3
1414

1515
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v1
16+
uses: docker/setup-buildx-action@v3
1717

1818
- name: Login to GitHub Container Registry
19-
uses: docker/login-action@v1
19+
uses: docker/login-action@v3
2020
with:
2121
registry: ghcr.io
2222
username: ${{ github.repository_owner }}
2323
password: ${{ secrets.GITHUB_TOKEN }}
2424

2525
- name: Build Docker image
26-
uses: docker/build-push-action@v2
26+
uses: docker/build-push-action@v5
2727
with:
2828
context: .
2929
file: Dockerfile

.github/workflows/release.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1515
- name: Setup release please
16-
uses: google-github-actions/release-please-action@v2
16+
uses: google-github-actions/release-please-action@v3
1717
id: release
1818
with:
1919
token: ${{ secrets.GITHUB_TOKEN }}
@@ -23,23 +23,23 @@ jobs:
2323

2424
- name: Set up QEMU
2525
if: ${{ steps.release.outputs.release_created }}
26-
uses: docker/setup-qemu-action@v1
26+
uses: docker/setup-qemu-action@v3
2727

2828
- name: Set up Docker Buildx
2929
if: ${{ steps.release.outputs.release_created }}
30-
uses: docker/setup-buildx-action@v1
30+
uses: docker/setup-buildx-action@v3
3131

3232
- name: Login to GitHub Container Registry
3333
if: ${{ steps.release.outputs.release_created }}
34-
uses: docker/login-action@v1
34+
uses: docker/login-action@v3
3535
with:
3636
registry: ghcr.io
3737
username: ${{ github.repository_owner }}
3838
password: ${{ secrets.GITHUB_TOKEN }}
3939

4040
- name: Build Docker image
4141
if: ${{ steps.release.outputs.release_created }}
42-
uses: docker/build-push-action@v2
42+
uses: docker/build-push-action@v5
4343
with:
4444
context: .
4545
file: Dockerfile

experiment.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"operationName": "OffersContext_Offers_And_Items",
1414
"variables": {"pageSize": 999},
1515
"extensions": {},
16-
"query": "query OffersContext_Offers_And_Items($dateOverride: Time, $pageSize: Int) {\n inGameLoot: items(\n collectionType: LOOT\n dateOverride: $dateOverride\n pageSize: $pageSize\n ) {\n items {\n ...Item\n __typename\n }\n __typename\n }\n}\n\nfragment Item on Item {\n id\n isDirectEntitlement\n requiresLinkBeforeClaim\n grantsCode\n isDeepLink\n isFGWP\n offers {\n ...Item_Offer\n __typename\n }\n game {\n ...Game\n __typename\n }\n __typename\n}\n\n\nfragment Item_Offer on Offer {\n id\n offerSelfConnection {\n eligibility {\n ...Item_Offer_Eligibility\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment Item_Offer_Eligibility on OfferEligibility {\n isClaimed\n canClaim\n missingRequiredAccountLink\n}\n\nfragment Game on GameV2 {\n id\n assets {\n title\n publisher\n }\n}\n",
16+
"query": "query OffersContext_Offers_And_Items($dateOverride: Time, $pageSize: Int) {\n inGameLoot: items(\n collectionType: LOOT\n dateOverride: $dateOverride\n pageSize: $pageSize\n ) {\n items {\n ...Item\n __typename\n }\n __typename\n }\n}\n\nfragment Item on Item {\n id\n isDirectEntitlement\n requiresLinkBeforeClaim\n grantsCode\n isDeepLink\n isFGWP\n offers {\n ...Item_Offer\n __typename\n }\n game {\n ...Game\n __typename\n }\n __typename\n}\n\n\nfragment Item_Offer on Offer {\n id\n offerSelfConnection {\n eligibility {\n ...Item_Offer_Eligibility\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment Item_Offer_Eligibility on OfferEligibility {\n isClaimed\n canClaim\n missingRequiredAccountLink\n}\n\nfragment Game on GameV2 {\n id\n assets {\n title\n publisher\n }\n}\n", # noqa: E501 TODO: This needs to become a non \n formatted string somewhere, just not doing it now
1717
}
1818

1919

2020
async def claim_offer(offer_id: str, item: dict, client: httpx.AsyncClient, headers: dict) -> True:
21-
if item["offers"][0]["offerSelfConnection"]["eligibility"]["isClaimed"] != True:
21+
if not item["offers"][0]["offerSelfConnection"]["eligibility"]["isClaimed"]:
2222
if (
23-
item["offers"][0]["offerSelfConnection"]["eligibility"]["canClaim"] == False
24-
and item["offers"][0]["offerSelfConnection"]["eligibility"]["missingRequiredAccountLink"] == True
23+
item["offers"][0]["offerSelfConnection"]["eligibility"]["canClaim"] is False
24+
and item["offers"][0]["offerSelfConnection"]["eligibility"]["missingRequiredAccountLink"] is True
2525
):
2626
log.error(f"Cannot collect game `{item['game']['assets']['title']}`, account link required.")
2727
return
@@ -35,11 +35,11 @@ async def claim_offer(offer_id: str, item: dict, client: httpx.AsyncClient, head
3535
}
3636
},
3737
"extensions": {},
38-
"query": "fragment Place_Orders_Payload_Order_Information on OfferOrderInformation {\n catalogOfferId\n claimCode\n entitledAccountId\n entitledAccountName\n id\n orderDate\n orderState\n __typename\n}\n\nmutation placeOrdersDetailPage($input: PlaceOrdersInput!) {\n placeOrders(input: $input) {\n error {\n code\n __typename\n }\n orderInformation {\n ...Place_Orders_Payload_Order_Information\n __typename\n }\n __typename\n }\n}\n",
38+
"query": "fragment Place_Orders_Payload_Order_Information on OfferOrderInformation {\n catalogOfferId\n claimCode\n entitledAccountId\n entitledAccountName\n id\n orderDate\n orderState\n __typename\n}\n\nmutation placeOrdersDetailPage($input: PlaceOrdersInput!) {\n placeOrders(input: $input) {\n error {\n code\n __typename\n }\n orderInformation {\n ...Place_Orders_Payload_Order_Information\n __typename\n }\n __typename\n }\n}\n", # noqa: E501 TODO: This needs to become a non \n formatted string somewhere, just not doing it now
3939
}
4040

4141
response = await client.post(gql_url, headers=headers, data=json.dumps(claim_payload))
42-
if response.json()["data"]["placeOrders"]["error"] != None:
42+
if response.json()["data"]["placeOrders"]["error"] is not None:
4343
log.error(f"Error: {response.json()['data']['placeOrders']['error']}")
4444

4545

@@ -64,6 +64,8 @@ async def primelooter(cookie_file):
6464
response = await client.post(gql_url, headers=json_headers, data=json.dumps(offers_payload))
6565
data = response.json()["data"]["inGameLoot"]["items"]
6666

67-
coros = await asyncio.gather(
67+
# although insanely low, python WILL garbage collect running coroutines if their references
68+
# aren't stored somewhere, therefore we noqa the Flake8 issue yelling at us about it.
69+
coros = await asyncio.gather( # noqa: F841
6870
*[claim_offer(item["offers"][0]["id"], item, client, json_headers) for item in data]
6971
)

0 commit comments

Comments
 (0)