From adf8c590ccf53dd138b6e34b28aee23fac712e78 Mon Sep 17 00:00:00 2001 From: souvik Date: Wed, 11 Sep 2024 15:04:51 +0530 Subject: [PATCH 01/11] feat: add command for transferring issue. --- .github/workflows/help-command.yml | 3 ++- .github/workflows/transfer-issue.yml | 35 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/transfer-issue.yml diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 3f4dcbc4..4dc443d2 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -58,5 +58,6 @@ jobs: At the moment the following comments are supported in issues: - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. - example: \`/gfi js\` or \`/good-first-issue ci-cd\`` + example: \`/gfi js\` or \`/good-first-issue ci-cd\` + - \`/trasfer-issue {repo-name}\` or \`/ti {repo-name}\` - trasfers issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/trasfer-issue cli\` }) \ No newline at end of file diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml new file mode 100644 index 00000000..2e1126ce --- /dev/null +++ b/.github/workflows/transfer-issue.yml @@ -0,0 +1,35 @@ + +name: Transfer Issues between repositories + +on: + issue_comment: + types: + - created + + +jobs: + transfer: + if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (contains(github.event.comment.body, '/trasfer-issue') || contains(github.event.comment.body, '/ti'))}} + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install GitHub CLI + run: | + sudo apt-get update + sudo apt-get install gh + - name: Authenticate GitHub CLI + run: | + gh action login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" + + - name: Extract Input + id: extract_step + run: | + COMMENT="${{github.event.comment.body}}" + REPO=$(echo $COMMENT | awk '{print $2}') + echo repo=$REPO >> $GITHUB_OUTPUT + + - name: Trasfer Issue + run: | + gh issue transfer ${{github.event.issue.number}} asyncapi/${{steps.extract_step.outputs.repo}} + From 24e955281e5d3fdd2b7ee2c8c407e6b1ff8bce61 Mon Sep 17 00:00:00 2001 From: souvik Date: Wed, 18 Sep 2024 19:05:43 +0530 Subject: [PATCH 02/11] feat: add changes requested --- .github/workflows/global-replicator.yml | 2 +- .github/workflows/transfer-issue.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index b4ee56f2..6096d690 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -138,7 +138,7 @@ jobs: uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: github_token: ${{ secrets.GH_TOKEN }} - patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml,.github/workflows/update-pr.yml + patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml,.github/workflows/update-pr.yml,.github/workflows/trasfer-issue.yml committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index 2e1126ce..3d41c4e2 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -9,18 +9,18 @@ on: jobs: transfer: - if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (contains(github.event.comment.body, '/trasfer-issue') || contains(github.event.comment.body, '/ti'))}} + if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (startsWith(github.event.comment.body, '/trasfer-issue') || startsWith(github.event.comment.body, '/ti'))}} runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install GitHub CLI run: | sudo apt-get update sudo apt-get install gh - name: Authenticate GitHub CLI run: | - gh action login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" + gh action login --with-token <<< "${{ secrets.GH_TOKEN }}" - name: Extract Input id: extract_step From 76ee381397ba19a8493ca08bfaca51f6dc5fe9a8 Mon Sep 17 00:00:00 2001 From: souvik Date: Thu, 19 Sep 2024 11:24:52 +0530 Subject: [PATCH 03/11] Update transfer-issue.yml --- .github/workflows/transfer-issue.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index 3d41c4e2..7137c885 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -6,7 +6,6 @@ on: types: - created - jobs: transfer: if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (startsWith(github.event.comment.body, '/trasfer-issue') || startsWith(github.event.comment.body, '/ti'))}} @@ -14,22 +13,13 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Install GitHub CLI - run: | - sudo apt-get update - sudo apt-get install gh - - name: Authenticate GitHub CLI - run: | - gh action login --with-token <<< "${{ secrets.GH_TOKEN }}" - - name: Extract Input id: extract_step run: | COMMENT="${{github.event.comment.body}}" REPO=$(echo $COMMENT | awk '{print $2}') echo repo=$REPO >> $GITHUB_OUTPUT - - name: Trasfer Issue + working-directory: ./ run: | gh issue transfer ${{github.event.issue.number}} asyncapi/${{steps.extract_step.outputs.repo}} - From bdaf695c580201015aca65de175742fe372d3264 Mon Sep 17 00:00:00 2001 From: souvik Date: Wed, 9 Oct 2024 11:26:16 +0530 Subject: [PATCH 04/11] Update global-replicator.yml --- .github/workflows/global-replicator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index 6096d690..f4a25a59 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -138,7 +138,7 @@ jobs: uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: github_token: ${{ secrets.GH_TOKEN }} - patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml,.github/workflows/update-pr.yml,.github/workflows/trasfer-issue.yml + patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml,.github/workflows/update-pr.yml,.github/workflows/transfer-issue.yml committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" From be6dd03232046b367386690a2256fe0214870975 Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 28 Oct 2024 11:18:32 +0530 Subject: [PATCH 05/11] chore: typo fix --- .github/workflows/help-command.yml | 2 +- .github/workflows/transfer-issue.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 4dc443d2..107f4b3d 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -59,5 +59,5 @@ jobs: - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. example: \`/gfi js\` or \`/good-first-issue ci-cd\` - - \`/trasfer-issue {repo-name}\` or \`/ti {repo-name}\` - trasfers issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/trasfer-issue cli\` + - \`/trasfer-issue {repo-name}\` or \`/ti {repo-name}\` - trasfers issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\` }) \ No newline at end of file diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index 7137c885..bfe0e9e2 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -8,7 +8,7 @@ on: jobs: transfer: - if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (startsWith(github.event.comment.body, '/trasfer-issue') || startsWith(github.event.comment.body, '/ti'))}} + if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (startsWith(github.event.comment.body, '/transfer-issue') || startsWith(github.event.comment.body, '/ti'))}} runs-on: ubuntu-latest steps: - name: Checkout Repository From 97c83230c1e1ac721f6d6d861beb9be8c1614a35 Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 11 Nov 2024 11:46:23 +0530 Subject: [PATCH 06/11] Update transfer-issue.yml --- .github/workflows/transfer-issue.yml | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index bfe0e9e2..723b1867 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -19,7 +19,37 @@ jobs: COMMENT="${{github.event.comment.body}}" REPO=$(echo $COMMENT | awk '{print $2}') echo repo=$REPO >> $GITHUB_OUTPUT + - name: Check Repo + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const r = process.env.GITHUB_REPOSITORY + const [owner, repo] = r.split('/') + console.log(process.env.GITHUB_REPOSITORY) + const repoToMove = process.env.REPO_TO_MOVE + const issue_number = process.env.ISSUE_NUMBER + try { + const {data} = await github.rest.repos.get({ + owner, + repo: repoToMove + }) + }catch (e) { + const body = `${repoToMove} is not a repo under ${owner}. You can only transfer issue to repos that belong to the same organisation.` + console.log(issue_number, owner, repo, repoToMove) + await github.rest.issues.createComment({ + owner, + repo, + issue_number, + body + }) + process.exit(1) + } - name: Trasfer Issue + id: transferIssue working-directory: ./ run: | gh issue transfer ${{github.event.issue.number}} asyncapi/${{steps.extract_step.outputs.repo}} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From 78445963e158e41c629a7e642810623399a874bd Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 11 Nov 2024 11:49:21 +0530 Subject: [PATCH 07/11] Update transfer-issue.yml --- .github/workflows/transfer-issue.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index 723b1867..f6de0b56 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -26,7 +26,6 @@ jobs: script: | const r = process.env.GITHUB_REPOSITORY const [owner, repo] = r.split('/') - console.log(process.env.GITHUB_REPOSITORY) const repoToMove = process.env.REPO_TO_MOVE const issue_number = process.env.ISSUE_NUMBER try { @@ -36,7 +35,6 @@ jobs: }) }catch (e) { const body = `${repoToMove} is not a repo under ${owner}. You can only transfer issue to repos that belong to the same organisation.` - console.log(issue_number, owner, repo, repoToMove) await github.rest.issues.createComment({ owner, repo, From 113226c32a356ef33e1e25a4ad0df483e2befe5e Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 11 Nov 2024 11:52:26 +0530 Subject: [PATCH 08/11] fix: typo fixes --- .github/workflows/help-command.yml | 2 +- .github/workflows/transfer-issue.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 107f4b3d..7bd3d9be 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -59,5 +59,5 @@ jobs: - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. example: \`/gfi js\` or \`/good-first-issue ci-cd\` - - \`/trasfer-issue {repo-name}\` or \`/ti {repo-name}\` - trasfers issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\` + - \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\` }) \ No newline at end of file diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index f6de0b56..338fe775 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -43,7 +43,7 @@ jobs: }) process.exit(1) } - - name: Trasfer Issue + - name: Transfer Issue id: transferIssue working-directory: ./ run: | From 61501b45a74ce7b7e8c11bbc16886e327c3a2efc Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 11 Nov 2024 11:56:23 +0530 Subject: [PATCH 09/11] Update help-command.yml --- .github/workflows/help-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 7bd3d9be..efd82e38 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -59,5 +59,5 @@ jobs: - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. example: \`/gfi js\` or \`/good-first-issue ci-cd\` - - \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\` + - \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\`. }) \ No newline at end of file From 62feb9a267d93461a2bc7f03e80101b3e3d5cd0b Mon Sep 17 00:00:00 2001 From: souvik Date: Tue, 12 Nov 2024 09:56:50 +0530 Subject: [PATCH 10/11] chore: requested changes. --- .github/workflows/help-command.yml | 2 +- .github/workflows/transfer-issue.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index efd82e38..12f5a94c 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -59,5 +59,5 @@ jobs: - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. example: \`/gfi js\` or \`/good-first-issue ci-cd\` - - \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\`. + - \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\`.` }) \ No newline at end of file diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index 338fe775..95ab3fcc 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -27,7 +27,7 @@ jobs: const r = process.env.GITHUB_REPOSITORY const [owner, repo] = r.split('/') const repoToMove = process.env.REPO_TO_MOVE - const issue_number = process.env.ISSUE_NUMBER + const issue_number = context.issue.number try { const {data} = await github.rest.repos.get({ owner, From 42c232d16ec313f027babad6d1226875bda5a988 Mon Sep 17 00:00:00 2001 From: Souvik De Date: Sun, 29 Dec 2024 10:17:21 +0530 Subject: [PATCH 11/11] Update transfer-issue.yml --- .github/workflows/transfer-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/transfer-issue.yml b/.github/workflows/transfer-issue.yml index 95ab3fcc..4a4ac0ac 100644 --- a/.github/workflows/transfer-issue.yml +++ b/.github/workflows/transfer-issue.yml @@ -49,5 +49,5 @@ jobs: run: | gh issue transfer ${{github.event.issue.number}} asyncapi/${{steps.extract_step.outputs.repo}} env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }}