Update Spring Cloud Azure Support File #769
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}" |