-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add command for transferring issue #314
base: master
Are you sure you want to change the base?
Changes from all commits
adf8c59
24e9552
76ee381
bdaf695
be6dd03
97c8323
7844596
113226c
61501b4
9128ef5
62feb9a
1965c11
b983ab0
42c232d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/transfer-issue.yml | ||
committer_username: asyncapi-bot | ||
committer_email: [email protected] | ||
commit_message: "ci: update of files from global .github repo" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
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') && (startsWith(github.event.comment.body, '/transfer-issue') || startsWith(github.event.comment.body, '/ti'))}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Extract Input | ||
id: extract_step | ||
run: | | ||
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('/') | ||
const repoToMove = process.env.REPO_TO_MOVE | ||
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically where is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no line and anyway you should access it like |
||
const issue_number = context.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.` | ||
await github.rest.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number, | ||
body | ||
}) | ||
process.exit(1) | ||
} | ||
- name: Transfer Issue | ||
id: transferIssue | ||
working-directory: ./ | ||
run: | | ||
gh issue transfer ${{github.event.issue.number}} asyncapi/${{steps.extract_step.outputs.repo}} | ||
derberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you switch to use standard way of doing things accessing context: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context
${{ github.repository }}