Skip to content

agent_ui_updated

agent_ui_updated #9

name: React to Agent-UI Repository Changes
on:
repository_dispatch:
types: [agent_ui_updated]
permissions:
contents: read
jobs:
update-agent-ui:
if: github.event.client_payload.repo == 'kubev2v/migration-planner-agent-ui'
concurrency:
group: agent-ui-update
cancel-in-progress: true
runs-on: ubuntu-latest
env:
BRANCH_NAME: "update-agent-ui"
CONFIG_FILE: "build/migration-planner-iso/config"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Read payload
id: payload
env:
SHA: ${{ github.event.client_payload.sha }}
REPO: ${{ github.event.client_payload.repo }}
run: |
echo "new_sha=$SHA" >> $GITHUB_OUTPUT
echo "repo=$REPO" >> $GITHUB_OUTPUT
- name: Update config file
id: update
env:
NEW_SHA: ${{ steps.payload.outputs.new_sha }}
run: |
sed -i "s/^AGENT_UI_IMAGE_TAG=.*/AGENT_UI_IMAGE_TAG=$NEW_SHA/" "$CONFIG_FILE"
grep -q "^AGENT_UI_IMAGE_TAG=$NEW_SHA" "$CONFIG_FILE" || { echo "ERROR: sed substitution failed"; exit 1; }
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.MIGRATION_PLANNER_SYNC_APP_ID }}
private-key: ${{ secrets.MIGRATION_PLANNER_SYNC_APP_PRIVATE_KEY }}
owner: kubev2v
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.app-token.outputs.token }}
branch: ${{ env.BRANCH_NAME }}
commit-message: |
NO-JIRA | feat: Agent-UI repository changes have been detected.
Update Agent-UI to SHA: ${{ steps.payload.outputs.new_sha }}.
title: "[AUTOMATION] Update Agent-UI image tag"
body: |
Auto update triggered by ${{ steps.payload.outputs.repo }}.
SHA: ${{ steps.payload.outputs.new_sha }}.
delete-branch: true