-
Notifications
You must be signed in to change notification settings - Fork 6
58 lines (58 loc) · 2.89 KB
/
update-spring-cloud-azure-support-file.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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}}"