AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Fix pushing cassettes in CI
Reinier van der Leerce440128667e
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 3388edb08e..b27e477e14 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -89,7 +89,8 @@ jobs:repository: ${{ github.event.pull_request.head.repo.full_name }}submodules: true- - name: Check out cassettes+ - id: checkout_cassettes+ name: Check out cassettesif: ${{ startsWith(github.event_name, 'pull_request') }}run: |cassette_branch="${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.head.ref }}"@@ -110,9 +111,11 @@ jobs:git merge --abortgit checkout ${{ github.event.pull_request.base.ref }}fi+ echo "cassette_branch=$(git branch --show-current)" >> $GITHUB_OUTPUTelseecho "Branch '$cassette_branch' does not exist in cassette submodule."\"Using cassettes from ${{ github.event.pull_request.base.ref }}."+ echo "cassette_branch=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUTfi- name: Set up Python ${{ matrix.python-version }}@@ -166,6 +169,7 @@ jobs:if [[ "${{ startsWith(github.event_name, 'pull_request') }}" = "true" ]]; thenis_pull_request=truecassette_branch="${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.head.ref }}"+ cassette_source_branch="${{ steps.checkout_cassettes.outputs.cassette_branch }}"base_branch="${{ github.event.pull_request.base.ref }}"elsecurrent_branch=$(echo ${{ github.ref }} | sed -e "s/refs\/heads\///g")@@ -173,13 +177,16 @@ jobs:ficd tests/Auto-GPT-test-cassettes- git fetch origin $cassette_branch+ git fetch origin $cassette_source_branch# Commit & push changes to cassettes if any- if ! git diff-index --quiet $cassette_branch; then+ if ! git diff-index --quiet $cassette_source_branch; then+ if ! [ "$cassette_branch" = "$cassette_source_branch" ]; then+ git checkout -b $cassette_branch+ figit add .git commit -m "Auto-update cassettes"- git pull --rebase origin $cassette_branch+ git pull --rebase origin $cassette_source_branchgit push origin HEAD:$cassette_branch