Skip to content

Optimize string migration: only return new value if needed #1161

Optimize string migration: only return new value if needed

Optimize string migration: only return new value if needed #1161

name: BackwardCompatibilityCheck
on:
workflow_dispatch:
inputs:
repo:
description: Repository (defaults to 'onflow/cadence')
branch:
description: 'Current branch/tag'
required: true
default: 'master'
base:
description: 'Base branch/tag'
required: true
default: 'latest'
pull_request:
branches:
# `feature/**` branches are not included because we would also develop breaking changes
# (large features in particular) in their own feature branches, other than the stable-cadence branch.
# Feature branches would get checked when they are going to get merged into the `master` anyway.
- master
- 'v**'
env:
GO_VERSION: '1.20'
concurrency:
group: ${{ github.workflow }}-${{ inputs.base || github.run_id }}
cancel-in-progress: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
# Map step output to the job output, so that next job can use these values.
repo: ${{ steps.setup.outputs.repo }}
branch: ${{ steps.setup.outputs.branch }}
base: ${{ steps.setup.outputs.base }}
steps:
- name: Setup
id: setup
# If the workflow is running on a pull request, then take the PR's source branch as the current branch,
# and the PR's target as the base branch.
#
# When getting the PR's source branch, Use the commit hash ('github.event.pull_request.head.sha'),
# instead of the branch name, since 'go get' command does not support all kinds of branch names.
#
# Here there also is a limitation that we can't use the 'merge-branch' because it is not visible to 'go get'.
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "repo=`(echo "${{ github.event.pull_request.head.repo.full_name }}")`" >> $GITHUB_OUTPUT
echo "branch=`(echo "${{ github.event.pull_request.head.sha }}")`" >> $GITHUB_OUTPUT
echo "base=`(echo "${{ github.base_ref }}")`" >> $GITHUB_OUTPUT
else
echo "repo=`(echo "${{ inputs.repo || github.repository }}")`" >> $GITHUB_OUTPUT
echo "branch=`(echo "${{ inputs.branch }}")`" >> $GITHUB_OUTPUT
echo "base=`(echo "${{ inputs.base }}")`" >> $GITHUB_OUTPUT
fi
mainnet:
needs: setup
uses: ./.github/workflows/compatibility-check-template.yml
with:
repo: ${{ needs.setup.outputs.repo }}
base-branch: ${{ needs.setup.outputs.base }}
current-branch: ${{ needs.setup.outputs.branch }}
chain: mainnet
secrets:
FLOWDIVER_API_KEY: ${{ secrets.FLOWDIVER_API_KEY }}
testnet:
needs: setup
uses: ./.github/workflows/compatibility-check-template.yml
with:
repo: ${{ needs.setup.outputs.repo }}
base-branch: ${{ needs.setup.outputs.base }}
current-branch: ${{ needs.setup.outputs.branch }}
chain: testnet
secrets:
FLOWDIVER_API_KEY: ${{ secrets.FLOWDIVER_API_KEY }}