Skip to content

Update Lotus version in API tests #293

Update Lotus version in API tests

Update Lotus version in API tests #293

# This workflows, run daily, updates the Lotus version in the JSON-RPC API tests to the latest release,
# and submits a PR with the changes.
name: Update Lotus version in API tests
on:
workflow_dispatch:
schedule:
- cron: "0 7 * * *"
jobs:
update-lotus:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Update dependencies
run: |
NETWORK=calibnet
TAG=$(curl --silent https://api.github.com/repos/filecoin-project/lotus/releases | jq -r 'first | .tag_name')
CURRENT_TAG=$(grep -oP 'LOTUS_IMAGE=.*:\K.*' ./scripts/tests/api_compare/.env)
# If the the latest tag reported by the API is greater than the one we are currently using, update it.
# This avoids PRs when a new tag is of lower major/minor version than the current one. We still need to follow the
# largest version for calibration network compatibility.
if [[ "$(printf '%s\n' "$TAG" "$CURRENT_TAG" | sort -V | tail -n1)" != "$CURRENT_TAG" || "$CURRENT_TAG" == "$TAG"* ]]; then
echo "Updating Lotus version to $TAG"
sed -i "s/\(LOTUS_IMAGE=.*\):.*/\1:$TAG-$NETWORK/" ./scripts/tests/api_compare/.env
sed -i "s/\(LOTUS_IMAGE=.*\):.*/\1:$TAG-$NETWORK/" ./scripts/tests/bootstrapper/.env
sed -i "s/\(LOTUS_IMAGE=.*\):.*/\1:$TAG-$NETWORK/" ./scripts/tests/snapshot_parity/.env
else
echo "Lotus version is already up to date"
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
base: main
token: ${{ secrets.ACTIONS_PAT }}
commit-message: Update Lotus dependency
title: "[automated] Update Lotus version in API tests"
body: |
### Changes
- Updates Lotus version in the JSON-RPC API tests to the latest release.