Skip to content

Update Spring Cloud Azure Support File #799

Update Spring Cloud Azure Support File

Update Spring Cloud Azure Support File #799

name: Update Spring Cloud Azure Support File
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: 'Azure/spring-cloud-azure-tools'
- name: Generate Spring Cloud Azure Support File
run: |
mvn compile
mvn exec:java -P github-actions -ntp -Dupdate-spring-cloud-azure-support-file=true
- uses: actions/checkout@v3
with:
repository: 'Azure/azure-sdk-for-java'
path: 'azure-sdk-for-java'
ref: main
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0
- name: Make Decision Based on Git Diff and Branch Status
run: |
if [[ $(git ls-remote --heads ${{ secrets.BRANCH_REPO }} update-spring-cloud-azure-support-file | wc -l) -eq 0 ]]; then
cd azure-sdk-for-java
git checkout -b update-spring-cloud-azure-support-file
cp -f ../spring-cloud-azure-supported-spring.json sdk/spring/pipeline
if [[ -n "$(git status -s)" ]]; then
echo "need_update_file=true" >> $GITHUB_ENV
else
echo "No file changes, no commits."
fi
else
echo "Branch exists, cancel commit"
fi
- name: Push Commit
if: ${{ env.need_update_file == 'true' }}
run: |
cd azure-sdk-for-java
git config --global user.email github-actions@github.com
git config --global user.name github-actions
git add sdk/spring/pipeline/spring-cloud-azure-supported-spring.json
git commit -m "Update Spring Boot and Spring Cloud versions for the compatibility test. This commit is created by GitHub Action: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
git push "https://${{ secrets.USER }}:${{ secrets.ACCESS_TOKEN }}@github.com/${{ secrets.USER }}/azure-sdk-for-java.git"
- name: Create Pull Request
if: ${{ env.need_update_file == 'true' }}
uses: vsoch/pull-request-action@master
env:
PULL_REQUEST_TOKEN: ${{ secrets.ACCESS_TOKEN }}
PULL_REQUEST_REPOSITORY: Azure/azure-sdk-for-java
PULL_REQUEST_TITLE: "Update Spring Boot and Spring Cloud versions for the Spring compatibility tests"
PULL_REQUEST_FROM_BRANCH: "${{ secrets.USER }}:update-spring-cloud-azure-support-file"
PULL_REQUEST_BRANCH: "main"
PULL_REQUEST_BODY: "Update Spring Boot and Spring Cloud versions for the compatibility test.\n\nIf you merged this PR, please update [Spring Cloud Azure Timeline](https://github.com/Azure/azure-sdk-for-java/wiki/Spring-Cloud-Azure-Timeline).\n\nThis PR is created by GitHub Actions: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"