From bc3ebdff5f497f67dd959e254c37dc58c34ebf80 Mon Sep 17 00:00:00 2001 From: jdkurma Date: Tue, 19 May 2026 15:45:58 -0500 Subject: [PATCH 1/3] add updatecli for package category retrieval version update --- .github/workflows/run-updatecli.yml | 44 +++++++++++++++++++ ...mp-package-registry-categories-version.yml | 44 +++++++++++++++++++ .github/workflows/updatecli/values.d/scm.yml | 4 ++ 3 files changed, 92 insertions(+) create mode 100644 .github/workflows/run-updatecli.yml create mode 100644 .github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml create mode 100644 .github/workflows/updatecli/values.d/scm.yml diff --git a/.github/workflows/run-updatecli.yml b/.github/workflows/run-updatecli.yml new file mode 100644 index 000000000..68f01fb29 --- /dev/null +++ b/.github/workflows/run-updatecli.yml @@ -0,0 +1,44 @@ +--- +name: Run updatecli + +on: + workflow_dispatch: + schedule: + - cron: '0 1 * * 1-5' + pull_request: + paths: + - .github/workflows/updatecli/** + - .github/workflows/run-updatecli.yml + +permissions: + contents: read + +jobs: + updatecli: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v6 + + - name: Select diff action + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "UPDATECLI_ACTION=diff" >> $GITHUB_ENV + + - name: Select apply action + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "UPDATECLI_ACTION=apply" >> $GITHUB_ENV + + - name: Install Updatecli in the runner + uses: updatecli/updatecli-action@2c3221bc5f4499a99fec2c87d9de4a83cb30e990 #v3.1.3 + + - name: Run updatecli + # --experimental needed for commitusingapi option. + run: updatecli --experimental ${{ env.UPDATECLI_ACTION }} --config .github/workflows/updatecli --values .github/workflows/updatecli/values.d/scm.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml b/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml new file mode 100644 index 000000000..89aefadfd --- /dev/null +++ b/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml @@ -0,0 +1,44 @@ +--- +name: Bump Package Registry categories version +pipelineid: 'bump-package-registry-categories-version' + +actions: + default: + title: '[updatecli] Update Package Registry categories URL to {{ source "latestRegistryVersion" }}' + kind: github/pullrequest + scmid: default + spec: + labels: + - automation + - dependency + +scms: + default: + kind: github + spec: + owner: '{{ .scm.owner }}' + repository: '{{ .scm.repository }}' + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + username: '{{ requiredEnv "GITHUB_ACTOR" }}' + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + commitusingapi: true + branch: main + +sources: + latestRegistryVersion: + name: Get latest Package Registry version + kind: json + spec: + file: https://api.github.com/repos/elastic/package-registry/releases/latest + key: .tag_name + +targets: + update-package-registry-categories-url: + name: '[updatecli] Update Package Registry categories URL to {{ source "latestRegistryVersion" }}' + kind: file + sourceid: latestRegistryVersion + scmid: default + spec: + file: code/go/internal/validator/semantic/validate_datastream_package_categories.go + matchpattern: 'package-registry/v[0-9\.]+/categories/categories\.yml' + replacepattern: 'package-registry/{{ source "latestRegistryVersion" }}/categories/categories.yml' diff --git a/.github/workflows/updatecli/values.d/scm.yml b/.github/workflows/updatecli/values.d/scm.yml new file mode 100644 index 000000000..ccc5c4289 --- /dev/null +++ b/.github/workflows/updatecli/values.d/scm.yml @@ -0,0 +1,4 @@ +--- +scm: + owner: elastic + repository: package-spec From 8f2a84bb7c6628cc4031b618dc50f536f709b8bd Mon Sep 17 00:00:00 2001 From: jdkurma Date: Tue, 19 May 2026 16:22:34 -0500 Subject: [PATCH 2/3] remove dependency label --- .../updatecli.d/bump-package-registry-categories-version.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml b/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml index 89aefadfd..c3d9778ff 100644 --- a/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml +++ b/.github/workflows/updatecli/updatecli.d/bump-package-registry-categories-version.yml @@ -10,7 +10,6 @@ actions: spec: labels: - automation - - dependency scms: default: From a2c061067cd11cfbf9e93f3a2d92ea5a5dbf628c Mon Sep 17 00:00:00 2001 From: jdkurma Date: Tue, 19 May 2026 17:25:31 -0500 Subject: [PATCH 3/3] use explicit checkout --- .github/workflows/run-updatecli.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-updatecli.yml b/.github/workflows/run-updatecli.yml index 68f01fb29..1a309c189 100644 --- a/.github/workflows/run-updatecli.yml +++ b/.github/workflows/run-updatecli.yml @@ -22,7 +22,9 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Select diff action if: ${{ github.event_name == 'pull_request' }}