Skip to content
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

fix: fix undefined error and remove unused files #1325

Merged
merged 10 commits into from
Jul 26, 2024

Conversation

AayushSaini101
Copy link
Contributor

Resolves: #1324

@AayushSaini101 AayushSaini101 changed the title fix: fix undefined error fix: fix undefined error and remove unused files Jul 24, 2024
@AayushSaini101
Copy link
Contributor Author

@derberg There was some issue in the voting, I have fixed and tested, #1323 we need to remove unwanted files

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to make sure this new workflow can also be triggered manually:

  workflow_dispatch:
    inputs:
      bot_comment_url:
        description: |
          Provide URL pointing to gitvote bot comment that contains closing voting update. It looks like `https://github.com/asyncapi/community/issues/1313#issuecomment-2247595858`. We use this to update the voting summary in cases when we see errors in the voting status, when for example TSC member voted, but did a mistake and voted by adding emoji to main description or other bot comment instead of the correct way: which is adding an emoji to a comment from bot that opens the vote.
        required: true

in your script you need to check if the workflow was run manualy, parse the URL and extract data and use GitHub API GET /repos/{owner}/{repo}/issues/comments/{comment_id} to fetch the comment data and pass it to the script for later processing

@derberg
Copy link
Member

derberg commented Jul 24, 2024

most important changes that need to be done are here

#1325 (review)

and regarding the package and package-lock that were pushed to master by mistake, you need to remove them with this PR

runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Installing Module
run: npm install js-yaml@4.1.0
run: npm install @octokit/rest js-yaml@4.1.0 --no-save
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: npm install @octokit/rest js-yaml@4.1.0 --no-save
run: npm install js-yaml@4.1.0 --no-save

it is not needed, you don't even use it

GH rest is part of github context

@@ -2,15 +2,23 @@ const yaml = require('js-yaml');
const { readFile, writeFile } = require('fs').promises;
const path = require('path');

module.exports = async ({ context }) => {
module.exports = async ({ githuh, context, botCommentURL}) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github not githuh

and once you do it, later instead of const { Octokit } = await import("@octokit/rest"); you can do github.request

github-script action comes with authenticated rest client -> https://github.com/actions/github-script?tab=readme-ov-file. I think you used it in some other pr already

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed Octokit used @derberg

let message, eventNumber, eventTitle, orgName, repoName;

if (botCommentURL) {
await fetchCommentInformation()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very risky approach and error prone long term, you basically do not know what happens without reading the code of fetch. I mean sharing variables like this, end mutating them across different functions

instead fetchCommentInformation should return an object with all needed info, like orgName for example, and here you should assign returned values to variables

const voteCommentContext = await fetchCommentInformation();
orgName = voteCommentContext.orgName;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @derberg

@AayushSaini101
Copy link
Contributor Author

@derberg Need little bit testing more i will revert once done

@aeworxet
Copy link
Contributor

@asyncapi/bounty_team

@AayushSaini101
Copy link
Contributor Author

@derberg
Copy link
Member

derberg commented Jul 26, 2024

/rtm

@asyncapi-bot asyncapi-bot merged commit 3100867 into asyncapi:master Jul 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed
4 participants