8080 VERSION=$(awk -F': ' '/stackhpc_kolla_source_version:/ {print $2}' src/kayobe-config/etc/kayobe/stackhpc.yml | xargs)
8181 echo "version=${VERSION}" >> $GITHUB_OUTPUT
8282
83- - name : Debug Kolla version comparison
84- run : |
85- echo "Latest Tag: '${{ steps.latest_kolla_tag.outputs.latest_tag }}'"
86- echo "Current Version: '${{ steps.current_kolla_version.outputs.version }}'"
87-
8883 - name : Update and commit Kolla version if needed
8984 if : steps.latest_kolla_tag.outputs.latest_tag != steps.current_kolla_version.outputs.version
9085 run : |
@@ -117,11 +112,6 @@ jobs:
117112 VERSION=$(awk -F': ' '/stackhpc_kolla_ansible_source_version:/ {print $2}' src/kayobe-config/etc/kayobe/stackhpc.yml | xargs)
118113 echo "version=${VERSION}" >> $GITHUB_OUTPUT
119114
120- - name : Debug Kolla Ansible version comparison
121- run : |
122- echo "Latest Tag: '${{ steps.latest_kolla_ansible_tag.outputs.latest_tag }}'"
123- echo "Current Version: '${{ steps.current_kolla_ansible_version.outputs.version }}'"
124-
125115 - name : Update and commit Kolla Ansible version if needed
126116 if : steps.latest_kolla_ansible_tag.outputs.latest_tag != steps.current_kolla_ansible_version.outputs.version
127117 run : |
@@ -154,11 +144,6 @@ jobs:
154144 VERSION=$(grep 'kayobe@stackhpc/' src/kayobe-config/requirements.txt | sed 's/.*@//' | xargs)
155145 echo "version=${VERSION}" >> $GITHUB_OUTPUT
156146
157- - name : Debug Kayobe version comparison
158- run : |
159- echo "Latest Tag: '${{ steps.latest_kayobe_tag.outputs.latest_tag }}'"
160- echo "Current Version: '${{ steps.current_kayobe_version.outputs.version }}'"
161-
162147 - name : Update and commit Kayobe version if needed
163148 if : steps.latest_kayobe_tag.outputs.latest_tag != steps.current_kayobe_version.outputs.version
164149 run : |
@@ -175,29 +160,36 @@ jobs:
175160 - name : Check for new commits
176161 id : check_commits
177162 run : |
178- echo "--- Git Log ---"
179- git log --oneline --graph --all
180- echo "---------------"
181163 count=$(git rev-list --count ${{ inputs.openstack_version }}..HEAD)
182- echo "Commit count between ${{ inputs.openstack_version }} and HEAD is: $count"
183164 if [ "$count" -gt 0 ]; then
184165 echo "has_commits=true" >> $GITHUB_OUTPUT
185166 else
186167 echo "has_commits=false" >> $GITHUB_OUTPUT
187168 fi
188169 working-directory : src/kayobe-config
189170
190- - name : Propose changes via PR if required
171+ - name : Push commits
191172 if : steps.check_commits.outputs.has_commits == 'true'
192- uses : peter-evans/create-pull-request@v7
193- with :
194- path : src/kayobe-config
195- branch : ${{ steps.branch_name.outputs.name }}
196- base : ${{ inputs.openstack_version }}
197- delete-branch : true
198- title : " chore(deps): Bump dependencies for OpenStack ${{ inputs.openstack_codename }}"
199- body-path : pr_body.md
200- labels : |
201- automated
202- ${{ inputs.openstack_codename }}
173+ run : git push --force origin ${{ steps.branch_name.outputs.name }}
174+ working-directory : src/kayobe-config
175+
176+ - name : Create or Update Pull Request
177+ if : steps.check_commits.outputs.has_commits == 'true'
178+ env :
179+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
180+ working-directory : src/kayobe-config
181+ run : |
182+ EXISTING_PR=$(gh pr list --head "${{ steps.branch_name.outputs.name }}" --json number -q '.[0].number')
183+ if [ -n "$EXISTING_PR" ]; then
184+ echo "Pull request #${EXISTING_PR} already exists. Closing it before creating a new one."
185+ gh pr close $EXISTING_PR
186+ fi
187+ echo "Creating new pull request."
188+ gh pr create \
189+ --base "${{ inputs.openstack_version }}" \
190+ --head "${{ steps.branch_name.outputs.name }}" \
191+ --title "chore(deps): Bump dependencies for OpenStack ${{ inputs.openstack_codename }}" \
192+ --body-file ../../pr_body.md \
193+ --label "automated" \
194+ --label "${{ inputs.openstack_codename }}"
203195
0 commit comments