-
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?
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
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.
left some comments,
you also need to add this new workflow to https://github.com/asyncapi/.github/blob/master/.github/workflows/global-replicator.yml#L141 to have it replicated to all other repos
.github/workflows/transfer-issue.yml
Outdated
|
||
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'))}} |
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.
we should probably start using starts with instead of contains
@KhudaDad414 thoughts?
.github/workflows/help-command.yml
Outdated
@@ -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\` |
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.
trasfer
all over the place
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.
also aren't we missing a closing ` at the end of the line here?
would be good if you test new workflow and this help workflow in private repo to be 100% sure it all works - before we push it to all the other repos
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.
Don't think any ` is missing, it is rendering this
/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
.github/workflows/transfer-issue.yml
Outdated
COMMENT="${{github.event.comment.body}}" | ||
REPO=$(echo $COMMENT | awk '{print $2}') | ||
echo repo=$REPO >> $GITHUB_OUTPUT | ||
- name: Trasfer Issue |
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.
would be very useful to have some interaction with user of the command here,
if transfer fails (most probably some typo of repo name of misuse of command) we should drop a proper comment in issue that command failed, and they have to make it better - I'm pretty sure we do it for good first issue command
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 have added a step to check if the repo is under the same org and write a comment explaining this to the user.
.github/workflows/transfer-issue.yml
Outdated
script: | | ||
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 |
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.
please always use context
if code is executed in github-script
action, so do not read for example issue number from env variables but like this: context.issue.number
…ithub into trasferIssue-command
const r = process.env.GITHUB_REPOSITORY | ||
const [owner, repo] = r.split('/') | ||
const repoToMove = process.env.REPO_TO_MOVE |
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.
technically where is REPO_TO_MOVE
and GITHUB_REPOSITORY
coming from?
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.
GITHUB_REPOSITORY
is a env variable that is already present in the running it returns you repository name like asyncapi/cli
format.
REPO_TO_MOVE
is something I am extracting in the Extract Input
step and storing it in the env, and while calling the step Check Repo
I am passing REPO_TO_MOVE
as a env on line 55.
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.
there is no line 55
and also in Extract Input
there is no such thing as REPO_TO_MOVE
but repo
and anyway you should access it like steps.extract_step.outputs. repo
@Souvikns ping in case you forgot about this one |
I have tested the action here: https://github.com/Klifu/API/actions/runs/12532481994. |
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const r = process.env.GITHUB_REPOSITORY |
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 }}
const r = process.env.GITHUB_REPOSITORY | ||
const [owner, repo] = r.split('/') | ||
const repoToMove = process.env.REPO_TO_MOVE |
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.
there is no line 55
and also in Extract Input
there is no such thing as REPO_TO_MOVE
but repo
and anyway you should access it like steps.extract_step.outputs. repo
Description
In this PR I am adding a new workflow file to trasfer issue from one respository to another in AsyncAPI organisation. The command is
/trasfer-issue {repo-name}
or/ti {repo-name}
for exampleRelated issue(s)
Resolves #311