json-schema-org / community

A space to discuss community and organisational related things
85 stars 34 forks source link

Usage of "agenda" label to get PRs and Issues automatically added to the Open Community Weekly Meetings agenda. #301

Closed benjagm closed 1 year ago

benjagm commented 1 year ago

Open Community Weekly Meeting: 2023-01-16

Work Summary: In the past Open Community Working Meeting 2023-01-16 #294, we agreed on the usage of a new "agenda" label for tagging PRs or issues to be discussed in the meeting

As a result, a new action was captured owned by @benjagm with the purpose of building a GitHub automation to add the tagged issues/PRs as agenda items of the Open Community Weekly Meetings. For more context please check #294 notes and recording.

Context: JSON Schema Community is running an Open Community Weekly Meeting every Monday. For every meeting, a new issue is created 6 days before the meeting using the OCWM template, and during that time, everyone in the community is free to add new topics to the agenda. With this feature, we can make it easier to include PRs to be discussed as part of the agenda without having to do all the work manually.

Automation trigger: Every time someone adds the label "agenda" to a PR, that PR should be included in the agenda of the upcoming OCWM.

Outcome A new item will be added to the agenda, the PR will be added to the Topic column and the author to the Owner column.

Completing this work will mean the automation has been built, tested, and communicated among the community.

Do you think this work might require an Architectural Decision Record (ADR)? (significant or noteworthy)

No

Work Detail:

Any further requirements to resolve this issue

Relequestual commented 1 year ago

The OpenJS Foundation uses https://github.com/nodejs/create-node-meeting-artifacts We may not want to copy all of it, but some of it may be useful.

benjagm commented 1 year ago

Other resources:

benjagm commented 1 year ago

A great next feature to implement from here is to automatize 1)the messages to slack and 2) to social media to promote new Open Community Weekly Meetings.

ghost commented 1 year ago

One possible solution would be to configure Webhooks in every repository or at an organisation level and whenever there is a pull request with a particular label we trigger a workflow that edits the existing issue with the newly raised PR as well as author of the PR but the problem is only issue owners and users with push access can edit an issue. Maybe we could just use the owner / or someone with the write access (could pass their creds manually instead) to edit it out I guess

benjagm commented 1 year ago

Congrats for the great research @0xSudarshan . This is a great starting point but there are some clarifications needed.

The next step in my opinion might be to build and try this in a testing repo.

Relequestual commented 1 year ago

We might need to modify this issue, as I haven't found anything that supports org wide action triggers without using a webhook, which isn't ideal.

What might be preferable is to have an action which runs on a schedule to collect Issues and PRs from the org with the required label, and then replaces the right part of the template in the latest OCWM issue.

Would be best to do this in a test org.

Relequestual commented 1 year ago

@0xSudarshan I think you are looking for these details: https://docs.github.com/en/actions/security-guides/automatic-token-authentication ?

Also worth noting that there are a load of existing examples you can look at : https://github.com/actions

ghost commented 1 year ago

@Relequestual I am going to change my approach as to what u said . I was in an assumption that we will be implementing this to all repositories that come under this organisation so thought Webhooks would be the way to go since it captures event at org level and there wouldn't be any need for us to create it in individual repos .(I will avoid using using webhooks) and as you mentioned there aren't any org wise action triggers we need to set up actions in individual repository . I don't think we need a scheduler tho , we could just update the latest OCWM issue with the PR and the author name when the workflow is triggered in a particular repo that has a pr with the label "agenda"

gregsdennis commented 1 year ago

I haven't found anything that supports org wide action triggers without using a webhook - @Relequestual

I found https://blog.marcnuri.com/triggering-github-actions-across-different-repositories during the meeting.

Relequestual commented 1 year ago

I haven't found anything that supports org wide action triggers without using a webhook - @Relequestual

I found https://blog.marcnuri.com/triggering-github-actions-across-different-repositories during the meeting.

That's cool, but we need a "trigger", not "triggering". Webhooks would be the only viable way to proxy such, but I think an alternative approach would be better.

Relequestual commented 1 year ago

... I don't think we need a scheduler tho , we could just update the latest OCWM issue with the PR and the author name when the workflow is triggered in a particular repo that has a pr with the label "agenda" - @0xSudarshan

It needs to be Issues, PR's, and Discussions, across the org, but with the ability to exclude specific repos.

In fact, I think just making sure only PUBLIC repos are considered should be enough. We just don't want to automatically do anything based on anything in private repos in the org.

The workflow could be run manually. This would enable us to choose to run it or not depending on if the meeting is happening. We could modify the Issue template for the meeting to include a link to the workflow. We will need to modify it anyway to include a placeholder.

ghost commented 1 year ago

@Relequestual @benjagm @gregsdennis :

  1. We create a workflow which triggers when a PR/issue/discussion is raised under the label "agenda"
  2. The above can be be setup in public repos we need
  3. We create another workflow in separate a repository just like https://github.com/nodejs/create-node-meeting-artifacts that gets triggered when 1. gets triggered (this can be done using repository_dispatch - https://blog.marcnuri.com/triggering-github-actions-across-different-repositories )and make sure the workflow runs node js scripts to update the latest OCWM issue. Let me know if this sounds reasonable ? Also i do agree in making the workflow manual. we could do that as well
benjagm commented 1 year ago

I agree with @Relequestual on the benefits of triggering the workflow manually. @0xSudarshan lets follow the approach of building the logic in node.js like https://github.com/nodejs/create-node-meeting-artifacts to make it easier to modify the issue.

To make it easier to add the information to the PR we just need to add a placeholder (like https://github.com/nodejs/create-node-meeting-artifacts).

ghost commented 1 year ago

@Relequestual @benjagm I have built the workflow and added it to https://github.com/0xSudarshan/automated-artifacts-build

joesepi commented 1 year ago

The Node.js project and the OpenJS Foundation have been wanting to move away from create-node-meeting-artifacts and started work in this repo. I would be happy to work with anyone to continue moving this forward. ✌️ https://github.com/pkgjs/meet

ghost commented 1 year ago

@joesepi let me know what i can do to help . I am happy to help you guys

benjagm commented 1 year ago

Hi @joesepi . For the final solution we are not using the same approach than create-node-meeting-artifacts, @0xSudarshan has built a Github action that is going to be much easier to maintain. The initial version has to be triggered manually and it will add PRs and Issues properly labeled to the upcoming weekly meeting.

I do see https://github.com/pkgjs/meet as a great next step to our automations because I am creating the issues for the weekly meetings manually and having them scheduled will save a lot of time.

benjagm commented 1 year ago

Quick update: I am planning to add the code to the Community repo and setup everything tomorrow.

benjagm commented 1 year ago

Hi @0xSudarshan. I started the integration and testing of the Github action inside the Community repository using this fork: https://github.com/benjagm/community

Unfortunately I wasn't able to make it work. Find below the current error I am getting: https://github.com/benjagm/community/actions/runs/4418460663/jobs/7745616217

Run ./operations/automations/automated-artifacts-build file:///home/runner/work/community/community/operations/automations/automated-artifacts-build/build/index.js:8032 let body = workMeetings.data[0].body ^

TypeError: Cannot read properties of undefined (reading 'body') at file:///home/runner/work/community/community/operations/automations/automated-artifacts-build/build/index.js:8032:37 at processTicksAndRejections (node:internal/process/task_queues:96:5)

Any idea about what might be happening? What happens if there is no OCWM created?

ghost commented 1 year ago

@benjagm please label your OCWM issue with Working Meeting just like we do it in our community repository in this organisation . Also please use the latest build . It should work

Screenshot 2023-03-16 at 12 31 08 AM
benjagm commented 1 year ago

Thanks! I did it but the issue persist.

In both cases it may be helpful adding some echo messages like "There is no OCWM available" or "There are no items labeled".

Could it be possible to add the label name as repository variable?

ghost commented 1 year ago

@benjagm I have created a new build with the above changes and updated the README.md as well . I would suggest you to create a new fork of the repository and try it out

benjagm commented 1 year ago

Hi @0xSudarshan finally I was able to complete the integration and testing of the Github action and is available in the branch/folder: https://github.com/json-schema-org/community/tree/benjagm-githubaction-agenda-items/operations/actions/automated-artifacts-build

I have done some changes in the code:

Yo have done an amazing job and now only the PR approval is pending.

benjagm commented 1 year ago

I just started to receive some feedback in the #368 and there are 2 elements to consider:

I am working in a new version of the action and I'll love to get your feedback as soon as I have a first version @0xSudarshan .

benjagm commented 1 year ago

I updated the github action to make use of all the js code but embedded in the github action yaml by using actions/github-script@v6.

The PR is updated.

ghost commented 1 year ago

@benjagm great , went through what u have done . glad we made use of actions/github-script@v6 . it looks clean and simple now

benjagm commented 1 year ago

You made all the heavy lifting, I just adapted the code to actions/github-script. TEAM WORK!

I discovered actions/github-script working in other community actions and adapted this one for consistency.

Are you thinking in your next contribution? We have great issues in Test Suite and Bowtie. @Julian is the maintainer of both projects and is an awesome mentor.

Relequestual commented 1 year ago

@benjagm could you update https://github.com/orgs/json-schema-org/discussions/35 to note that people can label issues and PRs with agenda please? Then I think we can close this issue =]

benjagm commented 1 year ago

could you update https://github.com/orgs/json-schema-org/discussions/35 to note that people can label issues and PRs with agenda please?

Thanks for the reminder @Relequestual . I updated the PR, the OCWM issue template and I'll remind this feature to the Community.