name: Update build-chain-configuration-reader

on:
  repository_dispatch:
    types: [update-build-chain-configuration-reader]
  workflow_dispatch:
    inputs:
      version:
        description: Version of https://www.npmjs.com/package/@kie/build-chain-configuration-reader
        required: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false
      - uses: actions/setup-node@v6
        with:
          node-version: 24
      - run: npm i @kie/build-chain-configuration-reader@${{ github.event.client_payload.version }}
      - run: npm version patch --no-git-tag-version
      - name: Create Pull Request
        uses: gr2m/create-or-update-pull-request-action@v1.x
        env:
          GITHUB_TOKEN: ${{ secrets.UPDATE_BUILD_CHAIN }}
        with:
          title: Update build-chain-configuration-reader to ${{ github.event.client_payload.version }}
          body: >
            There is a new release of build-chain-configuration-reader. Verify that there are no breaking changes
          branch: build-chain-configuration-reader-${{ github.event.client_payload.version }}
          commit-message: build-chain-configuration-reader updated
          team_reviewers: kiegroup/productization
