Skip to content

Release 1.253.0 (#4441) #49

Release 1.253.0 (#4441)

Release 1.253.0 (#4441) #49

name: Create public versions PR
on:
push:
branches:
- main
# The only commits that will contain changes to the masterlist will be releases
paths:
- 'MASTERLIST.md'
workflow_dispatch:
jobs:
create-public-versions-pr:
name: Create Public Versions PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
# Needed to set up GATI token
id-token: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# Fetch current and previous commit to compare
fetch-depth: 2
- name: Update public-adapter-versions.yml
run: |
./.github/scripts/update-all-public-adapter-versions.sh HEAD~1
- name: Set branch name
run: |
echo "BRANCH=public-versions-update-${GITHUB_SHA::8}" >> "$GITHUB_ENV"
- name: Set PR title
run: |
PR_TITLE="$(
.github/scripts/list-public-adapter-version-changes.sh | jq -r '
if ((length) == 1) then
.[] | "Update public version of \(.name) from \(.old_version) to \(.new_version)"
else
"Update public version of \(length) adapters"
end'
)"
echo "Using the following PR title:"
echo "$PR_TITLE"
echo "PR_TITLE=$PR_TITLE" >> "$GITHUB_ENV"
- name: Set PR description
run: |
# Output old and new version of each changed adapter
PR_DESCRIPTION="$(
.github/scripts/list-public-adapter-version-changes.sh | jq -r '
.[] |
if (.old_version == null) then
"- \(.name) is new with version \(.new_version)"
elif (.new_version == null) then
"- \(.name) was removed"
else
"- \(.name) changed version from \(.old_version) to \(.new_version)"
end'
)"
echo "Using the following PR description:"
echo "$PR_DESCRIPTION"
{
echo "PR_DESCRIPTION<<EOF"
echo "$PR_DESCRIPTION"
echo EOF
} >> "$GITHUB_ENV"
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create branch ${{ env.BRANCH }}
run: |
git checkout -b $BRANCH
git push --set-upstream origin $BRANCH
- name: Sign commit and push
uses: planetscale/ghcommit-action@f035dd97212c4009aaa9e3197abf88f80d1d8d91 # v0.2.8
with:
commit_message: 'Update public adapter versions'
repo: ${{ github.repository }}
branch: ${{ env.BRANCH }}
empty: false
file_pattern: 'public-adapter-versions.yml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up GATI token for PR creation
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.GATI_AWS_ROLE_ARN_FOR_CREATE_PRS }}
aws-lambda-url: ${{ secrets.GATI_LAMBDA_DATA_FEEDS_URL }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Create Pull request
run: |
gh pr create --base main \
--head '${{ env.BRANCH }}' \
--title '${{ env.PR_TITLE }}' \
--body '${{ env.PR_DESCRIPTION }}'
env:
# If we use secrets.GITHUB_TOKEN, then the created PR doesn't
# trigger other workflows. So we use the token created in the
# previous step.
GITHUB_TOKEN: ${{ steps.setup-github-token.outputs.access-token }}