Skip to content

Commit 6ec6062

Browse files
authored
Introduce a repeatable process to create a PR in ansible-devspaces-demo repo (#558)
* Introduce a repeatable process to create a PR in redhat-developer-demos repo * Minor changes in PR steps * Create a PR using gh tool * Fork and then clone using gh tool * Remove unnecessary steps * Modify the sed command with fetching the latest image digest * Remove lock file
1 parent f8014cb commit 6ec6062

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/tox.yml

+27
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,33 @@ jobs:
116116
docker push "ghcr.io/ansible/ansible-devspaces:${{ github.event.release.tag_name }}"
117117
docker push "ghcr.io/ansible/ansible-devspaces:latest"
118118
119+
- name: Fork and Clone the target repository
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.ANSIBUDDY_BOT_PAT }}
122+
run: |
123+
gh repo fork [email protected]:redhat-developer-demos/ansible-devspaces-demo.git --clone
124+
cd ansible-devspaces-demo
125+
126+
- name: Create a new branch, update the file and push the branch
127+
run: |
128+
git checkout -b update-devspaces-image-${{ github.event.release.tag_name }}
129+
export SHA=$(docker manifest inspect -v ghcr.io/ansible/ansible-devspaces:latest | jq -r '[.Descriptor.digest][0]')
130+
sed -i "s|image:.*|image: ghcr.io/ansible/ansible-devspaces@${{ env.SHA }}|" devfile.yaml
131+
git add devfile.yaml
132+
git commit -m "Update devspaces container image SHA"
133+
git push origin update-devspaces-image-${{ github.event.release.tag_name }}
134+
135+
- name: Create a pull request
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.ANSIBUDDY_BOT_PAT }}
138+
run: |
139+
gh pr create \
140+
--title "Update ansible-devspaces container image" \
141+
--body "This PR updates the ansible-devspaces container image SHA to the latest." \
142+
--head "update-devspaces-image-'${{ github.event.release.tag_name }}'" \
143+
--base "main" \
144+
--repo "github.com/redhat-developer-demos/ansible-devspaces-demo"
145+
119146
publish-wheel:
120147
needs:
121148
- codeql

0 commit comments

Comments
 (0)