From 33983e0da96917d968c9cfe3194deefe09c2d6bf Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 17:05:38 +0200 Subject: [PATCH 01/12] add demo workflow for test --- .github/workflows/auto-update-pr.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/auto-update-pr.yml diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml new file mode 100644 index 00000000..0580b299 --- /dev/null +++ b/.github/workflows/auto-update-pr.yml @@ -0,0 +1,13 @@ +name: auto-update-pr + +on: + repository_dispatch: + types: [custom_event] + +jobs: + handle-custom-event: + runs-on: ubuntu-latest + steps: + - name: Print release tag + run: | + echo "Received release tag: ${{ github.event.client_payload.release_tag }}" From b4168b166b6787d225b892703fb0aa80ac1d2e2a Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:21:03 +0200 Subject: [PATCH 02/12] fix private repo missing token --- .github/workflows/auto-update-pr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 83092106..7d34aa6e 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -48,9 +48,11 @@ jobs: - name: get gencle and update pyclesperanto + env: + GH_TOKEN: ${{ secrets.RELEASE_PAT }} run: | - git clone https://github.com/clEsperanto/gencle gencle - python ./gencle/pyclesperanto_auto_update.py ${{ github.workspace }} "clEsperanto/CLIc" ${{ github.event.inputs.release_tag }} + git clone https://$RELEASE_PAT@github.com/clEsperanto/gencle.git gencle + python ./gencle/pyclesperanto_auto_update.py ${{ github.workspace }} "clEsperanto/CLIc" ${{ github.event.inputs.release_tag }} - name: Branch, Commit, and push changes From fe3698415072cba873c9f2342b69ebc70dca2303 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:24:35 +0200 Subject: [PATCH 03/12] try to get gh cli --- .github/workflows/auto-update-pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 7d34aa6e..428ff958 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -25,8 +25,9 @@ jobs: - name: Install GitHub CLI run: | - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 - sudo apt-add-repository https://cli.github.com/packages + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg + sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null sudo apt update sudo apt install gh From b6c13d3c12660401f4fda9376120153e1d41c8b7 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:28:38 +0200 Subject: [PATCH 04/12] set GH_TOKEN --- .github/workflows/auto-update-pr.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 428ff958..8c90d68f 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -39,13 +39,13 @@ jobs: - name: Create a new issue with the release tag - run: | - gh issue create --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" \ - --body "This issue is created by the auto-update workflow.\npyclesperanto can be updated with the CLIc version ${{ github.event.client_payload.release_tag }}.\n\nSee [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }})" \ - --label "auto-update" - export ISSUE_NUMBER=$(gh issue list --label "auto-update" --limit 1 --json number --jq '.[0].number') env: - ISSUE_NUMBER: ${{ steps.create_issue.outputs.ISSUE_NUMBER }} + GH_TOKEN: ${{ secrets.RELEASE_PAT }} + run: | + gh issue create --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" \ + --body "This issue is created by the auto-update workflow.\npyclesperanto can be updated with the CLIc version ${{ github.event.client_payload.release_tag }}.\n\nSee [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }})" \ + --label "auto-update" + export ISSUE_NUMBER=$(gh issue list --label "auto-update" --limit 1 --json number --jq '.[0].number') - name: get gencle and update pyclesperanto @@ -57,6 +57,8 @@ jobs: - name: Branch, Commit, and push changes + env: + GH_TOKEN: ${{ secrets.RELEASE_PAT }} run: | git checkout -b auto-update-${{ github.event.inputs.release_tag }} git add . @@ -66,7 +68,7 @@ jobs: - name: Create Pull Request env: - GITHUB_TOKEN: "${{ secrets.RELEASE_PAT }}" + GH_TOKEN: "${{ secrets.RELEASE_PAT }}" ISSUE_NUMBER: ${{ steps.create_issue.outputs.ISSUE_NUMBER }} run: | gh auth login --with-token <<< "${{ secrets.RELEASE_PAT }}" From 2e71fa9dec8d84ba4adbac63bd58a2c1fb49f4f8 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:33:01 +0200 Subject: [PATCH 05/12] fix token for private repo --- .github/workflows/auto-update-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 8c90d68f..3cc9e28a 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -52,7 +52,7 @@ jobs: env: GH_TOKEN: ${{ secrets.RELEASE_PAT }} run: | - git clone https://$RELEASE_PAT@github.com/clEsperanto/gencle.git gencle + git clone https://$GH_TOKEN@github.com/clEsperanto/gencle.git gencle python ./gencle/pyclesperanto_auto_update.py ${{ github.workspace }} "clEsperanto/CLIc" ${{ github.event.inputs.release_tag }} From 8f38177297ef0ff8288b9b9d1ce1ac1b4afb0696 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:36:06 +0200 Subject: [PATCH 06/12] WIP fix issue message --- .github/workflows/auto-update-pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 3cc9e28a..cced7fff 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -42,10 +42,10 @@ jobs: env: GH_TOKEN: ${{ secrets.RELEASE_PAT }} run: | - gh issue create --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" \ - --body "This issue is created by the auto-update workflow.\npyclesperanto can be updated with the CLIc version ${{ github.event.client_payload.release_tag }}.\n\nSee [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }})" \ - --label "auto-update" - export ISSUE_NUMBER=$(gh issue list --label "auto-update" --limit 1 --json number --jq '.[0].number') + gh issue create --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" \ + --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically created by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' \ + --label "auto-update" + export ISSUE_NUMBER=$(gh issue list --label "auto-update" --limit 1 --json number --jq '.[0].number') - name: get gencle and update pyclesperanto @@ -74,7 +74,7 @@ jobs: gh auth login --with-token <<< "${{ secrets.RELEASE_PAT }}" gh pr create \ --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}." \ - --body "This PR updates pyclesperanto tiers code to `clEsperanto/CLIc@${{ github.event.client_payload.release_tag }}`.\n\ncloses #${{ env.ISSUE_NUMBER }}" \ + --body $'This PR updates pyclesperanto tiers code to `clEsperanto/CLIc@${{ github.event.client_payload.release_tag }}`.\n\ncloses #${{ env.ISSUE_NUMBER }}'' \ --head auto-update-${{ github.event.client_payload.release_tag }} \ --base main \ --label "auto-update" From faddd9f55b7589d457639363f0ffd1b81bdb5ff5 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:53:43 +0200 Subject: [PATCH 07/12] test recycle issues --- .github/workflows/auto-update-pr.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index cced7fff..666a13f8 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -42,10 +42,17 @@ jobs: env: GH_TOKEN: ${{ secrets.RELEASE_PAT }} run: | - gh issue create --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" \ - --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically created by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' \ - --label "auto-update" - export ISSUE_NUMBER=$(gh issue list --label "auto-update" --limit 1 --json number --jq '.[0].number') + ISSUE_TITLE="Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" + EXISTING_ISSUE_NUMBER=$(gh issue list --search "$ISSUE_TITLE" --json number,title --jq '.[] | select(.title == env.ISSUE_TITLE) | .number') + if [ -z "$EXISTING_ISSUE_NUMBER" ]; then + ISSUE_NUMBER=$(gh issue create --title "$ISSUE_TITLE" \ + --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically created by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' \ + --label "auto-update" --json number --jq '.number') + else + gh issue comment $EXISTING_ISSUE_NUMBER --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically updated by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' + ISSUE_NUMBER=$EXISTING_ISSUE_NUMBER + fi + echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV - name: get gencle and update pyclesperanto From e86e0fc1bc1ea708af09756e14fff67402be5332 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 28 Aug 2024 18:57:22 +0200 Subject: [PATCH 08/12] WIP recyling issues --- .github/workflows/auto-update-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 666a13f8..d21ed488 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -47,7 +47,7 @@ jobs: if [ -z "$EXISTING_ISSUE_NUMBER" ]; then ISSUE_NUMBER=$(gh issue create --title "$ISSUE_TITLE" \ --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically created by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' \ - --label "auto-update" --json number --jq '.number') + --label "auto-update") else gh issue comment $EXISTING_ISSUE_NUMBER --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically updated by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' ISSUE_NUMBER=$EXISTING_ISSUE_NUMBER From 09e8957df488605826493b9367f95a326d9fb9e9 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 29 Aug 2024 09:56:17 +0200 Subject: [PATCH 09/12] add package requests --- .github/workflows/auto-update-pr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index d21ed488..1fd68249 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -1,4 +1,4 @@ -name: auto-update-pr +name: Auto Update on: repository_dispatch: @@ -22,6 +22,10 @@ jobs: with: python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests - name: Install GitHub CLI run: | From 5382c42d8ba926ab4d18828532053de1f6c9ce12 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 29 Aug 2024 14:50:27 +0200 Subject: [PATCH 10/12] kill auto update for now --- .github/workflows/auto-update-pr.yml | 77 ---------------------------- 1 file changed, 77 deletions(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index 1fd68249..d4ee6c35 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -12,80 +12,3 @@ jobs: run: | echo "Received release tag: ${{ github.event.client_payload.release_tag }} from CLIc" - - - name: Checkout - uses: actions/checkout@v2 - - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install requests - - - name: Install GitHub CLI - run: | - curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg - sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null - sudo apt update - sudo apt install gh - - - - name: Configure git - run: | - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" - - - - name: Create a new issue with the release tag - env: - GH_TOKEN: ${{ secrets.RELEASE_PAT }} - run: | - ISSUE_TITLE="Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}" - EXISTING_ISSUE_NUMBER=$(gh issue list --search "$ISSUE_TITLE" --json number,title --jq '.[] | select(.title == env.ISSUE_TITLE) | .number') - if [ -z "$EXISTING_ISSUE_NUMBER" ]; then - ISSUE_NUMBER=$(gh issue create --title "$ISSUE_TITLE" \ - --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically created by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' \ - --label "auto-update") - else - gh issue comment $EXISTING_ISSUE_NUMBER --body $'## Auto-update pyclesperanto\n\nThis issue has been automatically updated by the auto-update workflow.\n\n### Update Details\n- **pyclesperanto Version:** ${{ github.event.client_payload.release_tag }}\n- **CLIc Version:** ${{ github.event.client_payload.release_tag }}\n\n### Action Required\nPlease update pyclesperanto to the specified version.\n\n### Additional Information\nFor more details, refer to the [Release Notes](https://github.com/clEsperanto/CLIc/releases/tag/${{ github.event.client_payload.release_tag }}).\n\nThank you!' - ISSUE_NUMBER=$EXISTING_ISSUE_NUMBER - fi - echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV - - - - name: get gencle and update pyclesperanto - env: - GH_TOKEN: ${{ secrets.RELEASE_PAT }} - run: | - git clone https://$GH_TOKEN@github.com/clEsperanto/gencle.git gencle - python ./gencle/pyclesperanto_auto_update.py ${{ github.workspace }} "clEsperanto/CLIc" ${{ github.event.inputs.release_tag }} - - - - name: Branch, Commit, and push changes - env: - GH_TOKEN: ${{ secrets.RELEASE_PAT }} - run: | - git checkout -b auto-update-${{ github.event.inputs.release_tag }} - git add . - git commit -m "auto-update pyclesperanto to version ${{ github.event.inputs.release_tag }}" - git push origin auto-update-${{ github.event.inputs.release_tag }} - - - - name: Create Pull Request - env: - GH_TOKEN: "${{ secrets.RELEASE_PAT }}" - ISSUE_NUMBER: ${{ steps.create_issue.outputs.ISSUE_NUMBER }} - run: | - gh auth login --with-token <<< "${{ secrets.RELEASE_PAT }}" - gh pr create \ - --title "Auto-update pyclesperanto to version ${{ github.event.client_payload.release_tag }}." \ - --body $'This PR updates pyclesperanto tiers code to `clEsperanto/CLIc@${{ github.event.client_payload.release_tag }}`.\n\ncloses #${{ env.ISSUE_NUMBER }}'' \ - --head auto-update-${{ github.event.client_payload.release_tag }} \ - --base main \ - --label "auto-update" From be519daf5df9c362e19b3721eb0398e1c9144bf6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:30:20 +0000 Subject: [PATCH 11/12] Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.0 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.9.0...v1.10.0) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 8d58663a..a6516c57 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -76,7 +76,7 @@ jobs: path: dist merge-multiple: true - - uses: pypa/gh-action-pypi-publish@v1.9.0 + - uses: pypa/gh-action-pypi-publish@v1.10.0 with: password: ${{ secrets.PYPI_API_TOKEN }} skip-existing: true From b3b02b81bdafb7994e70abaebb29f3a36cef482e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:30:32 +0000 Subject: [PATCH 12/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/auto-update-pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/auto-update-pr.yml b/.github/workflows/auto-update-pr.yml index d4ee6c35..0ce00be1 100644 --- a/.github/workflows/auto-update-pr.yml +++ b/.github/workflows/auto-update-pr.yml @@ -11,4 +11,3 @@ jobs: - name: Print release tag run: | echo "Received release tag: ${{ github.event.client_payload.release_tag }} from CLIc" -