-
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: implemment pagination #266
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.
TBH I am not a fan of writing this action in bash. it is hard to maintain ( I don't speak bash). 😆
can you rewrite in in almighty js?
i am too not a big fan of bash but as @smoya had mentioned in the issue to use some bash thats why i have used bash but no problem i am converting it too js |
Totally no strong opinion on using bash or any language of our preference TBH. So 👍 on my side. |
@KhudaDad414 @smoya should i rewrite this in js or not |
@Min2who please rewrite to JS as we have a lot of experience with it and it will be much better to maintain long term. please use https://github.com/actions/github-script action that already have pagination related plugins added so writing such script will be much better DX and also much readable ❤️ so one step will be just getting data from GitHub API (by default afaik response will be stored as part of output that you will be able to access from another step https://github.com/actions/github-script?tab=readme-ov-file#reading-step-results). And in another step you will construct a commit message. such approach will make maintenance much better + will make is easier to debug in future |
As @derberg stated, +1 to use JS. From the very moment this is not gonna be a simple one liner as it was, it will become very hard to maintain. |
@KhudaDad414 @derberg @smoya can you suggest me some way to test this actions locally |
@Min2who actions are a little hard to test especially this one. I would suggest testing the script you write separately and making sure it gets what you want. testing the entire workflow is a little more challenging, you may need to test it on your fork. I think testing the script here suffices. |
i have updated this action using the github octokit.paginate plugin and have test this in my local fork action in this |
made the changes cc @KhudaDad414 |
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.
LGTM! please wait for @derberg's review. 🙇
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.
@Min2who hey, left some comments how you can improve the action
can you share some example where did you test it, a test run?
@utnim2 did you see my other comments? |
ahh sorry , working on it |
Done the reviewed changes The test of this action here |
@utnim2 lgtm but there were some changes done since initial implementation, can you show your changes somewhere in action, in some test repo? I can help if you need someone to open a PR in your repo, and then you make edits to make sure it works |
# 5. Removes repeated authors (authors can have more than one commit in the PR). | ||
# 6. Builds the `Co-authored-by: ...` lines with actual info. | ||
# 7. Transforms the array into plain text. Thanks to this, the actual stdout of this step can be used by the next Workflow step (wich is basically the automerge). | ||
cmd: | |
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 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.
Hi @Gmin2, I added some comments that will fix issues on workflow run.
const commitsResponse = await github.paginate("GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", { | ||
owner: repository.split('/')[0], | ||
repo: repository.split('/')[1], | ||
pull_number: ${{ github.event.number }}, | ||
per_page: 100, | ||
}); |
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.
Simplification and correction of the way to access the repo information:
const commitsResponse = await github.paginate("GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", { | |
owner: repository.split('/')[0], | |
repo: repository.split('/')[1], | |
pull_number: ${{ github.event.number }}, | |
per_page: 100, | |
}); | |
const { owner, repo } = context.repo; | |
const pull_number = context.issue.number; | |
const commitsResponse = await github.paginate("GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", { | |
owner, | |
repo, | |
pull_number, | |
per_page: 100 | |
}); |
|
||
await getCoAuthors(); |
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.
Correct way to set the output in the Get List of authors
step:
await getCoAuthors(); | |
const coAuthors = await getCoAuthors(); | |
core.setOutput("value", coAuthors); |
Description
Each co-author appear in a new line and implement pagination
Related issue(s)
Resolves #263