From 00b4483065fe32ab1ee4ea1d86e13531af468fd3 Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Mon, 24 Jul 2023 10:54:42 +0800 Subject: [PATCH] fix: actions milestones auto (#640) * fix: actions milestones auto Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: add org server secret Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .github/sync.yml | 18 ++++++++++++- .github/workflows/auto-assign-issue.yml | 9 ++++--- .github/workflows/auto-release.yml | 36 ++++++++++++------------- .github/workflows/cla.yml | 14 +++++----- .github/workflows/project-progress.yml | 2 +- 5 files changed, 48 insertions(+), 31 deletions(-) diff --git a/.github/sync.yml b/.github/sync.yml index fdc003a0f..03454c165 100644 --- a/.github/sync.yml +++ b/.github/sync.yml @@ -67,6 +67,10 @@ group: - repos: | OpenIMSDK/OpenKF@main OpenIMSDK/openim-miniprogram-demo@main + OpenIMSDK/docs + OpenIMSDK/chat + OpenIMSDK/community + OpenIMSDK/openim-charts OpenIMSDK/openim-sdk-cpp@main files: - source: LICENSE @@ -80,13 +84,25 @@ group: replace: false - source: .github/workflows/project-progress.yml dest: .github/workflows/project-progress.yml - replace: false + replace: false - source: .github/workflows/help-comment-issue.yml dest: .github/workflows/help-comment-issue.yml replace: false - source: .github/.codecov.yml dest: .github/.codecov.yml replace: false + - source: .github/workflows/cla.yml + dest: .github/workflows/cla.yml + replace: false + - source: .github/workflows/ + dest: .github/workflows/ + replace: false + - source: .github/workflows/auto-assign-issue.yml + dest: .github/workflows/auto-assign-issue.yml + replace: false + - source: .github/workflows/release.yml + dest: .github/workflows/release.yml + replace: false - source: ./scripts/githooks/ dest: ./scripts/githooks/ replace: true \ No newline at end of file diff --git a/.github/workflows/auto-assign-issue.yml b/.github/workflows/auto-assign-issue.yml index 66b30c219..7afebe028 100644 --- a/.github/workflows/auto-assign-issue.yml +++ b/.github/workflows/auto-assign-issue.yml @@ -2,7 +2,6 @@ name: Assign issue to comment author on: issue_comment: types: [created] - jobs: assign-issue: if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept') @@ -11,15 +10,17 @@ jobs: issues: write steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Assign the issue run: | + export LETASE_MILESTONES=$(curl "https://api.github.com/repos/$OWNER/$REPO/milestones" | jq -r 'last(.[]).title') gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}" gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted" - gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }}, this issue has been assigned to you. We are looking forward to your PR!" + gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES" + gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you.
I set the milestones for this issue to $LETASE_MILESTONES, we are looking forward to your PR!" env: - GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} ISSUE: ${{ github.event.issue.html_url }} OWNER: ${{ github.repository_owner }} REPO: ${{ github.event.repository.name }} \ No newline at end of file diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 15a77da9f..385a50c23 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -1,26 +1,26 @@ -name: Automatic Rebase +name: Assign issue to comment author on: issue_comment: types: [created] jobs: - rebase: - name: Rebase + assign-issue: + if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept') runs-on: ubuntu-latest - if: >- - github.event.issue.pull_request != '' && - ( - contains(github.event.comment.body, '/rebase') || - contains(github.event.comment.body, '/autosquash') - ) + permissions: + issues: write steps: - - name: Checkout the latest code + - name: Checkout code uses: actions/checkout@v3 - with: - token: ${{ secrets.BOT_GITHUB_TOKEN }} - fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - - name: Automatic Rebase - uses: cirrus-actions/rebase@1.8 - with: - autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }} + + - name: Assign the issue + run: | + export LETASE_MILESTONES=$(curl 'https://api.github.com/repos/kubecub/github-label-syncer/milestones' | jq -r 'last(.[]).title') + gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}" + gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted" + gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES" + gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you. I set the milestones for this issue to $LETASE_MILESTONES, We are looking forward to your PR!" env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} + ISSUE: ${{ github.event.issue.html_url }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} \ No newline at end of file diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 6bc295d43..65497a106 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -14,13 +14,12 @@ permissions: env: # Define Open-IM-Server variables here - REMOTE_ORGANIZATION: open-im-server + OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs REMOTE_REPOSITORY: cla - OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md - OPEN_IM_SERVER_SIGNATURES_PATH: signatures/openim-server/cla.json + OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json + OPEN_IM_SERVER_ALLOWLIST: kubbot,bot* - OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs jobs: CLAAssistant: @@ -40,9 +39,10 @@ jobs: remote-organization-name: ${{ env.OPEN_IM_SERVER_REMOTE_ORGANIZATION }} remote-repository-name: ${{ env.REMOTE_REPOSITORY }} - create-file-commit-message: '📚 Docs: Creating file for storing ${{ env.REMOTE_ORGANIZATION }} CLA Signatures' - custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md)' + + create-file-commit-message: '📚 Docs: Creating file for storing ${{ github.event.repository.name }} CLA Signatures' + custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md)
' custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA' - custom-allsigned-prcomment: '🤖 All Contributors have signed the ${{ env.REMOTE_ORGANIZATION }} [CLA](https://github.com/openim-sigs/cla/blob/main/README.md).' + custom-allsigned-prcomment: '🤖 All Contributors have signed the [${{ github.event.repository.name }} CLA](https://github.com/openim-sigs/cla/blob/main/README.md).
The signed information is recorded [🤖here](https://github.com/openim-sigs/cla/tree/main/signatures/${{ env.OPEN_IM_SERVER_ALLOWLIST }}/cla.json)' # lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) # use-dco-flag: true - If you are using DCO instead of CLA diff --git a/.github/workflows/project-progress.yml b/.github/workflows/project-progress.yml index 12e8615f4..d0cc10604 100644 --- a/.github/workflows/project-progress.yml +++ b/.github/workflows/project-progress.yml @@ -31,6 +31,6 @@ jobs: steps: - uses: alex-page/github-project-automation-plus@v0.8.3 with: - project: OpenIM 2023 Sprint 🔥 + project: OpenIM-V3.1 column: In Progress repo-token: ${{ secrets.BOT_GITHUB_TOKEN }} \ No newline at end of file