Skip to content

Commit

Permalink
ci: add new maintainers.yaml file with tsc_members.json data (#720)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
  • Loading branch information
14Richa and derberg committed Jul 5, 2023
1 parent 1dd876b commit 0f2ce62
Show file tree
Hide file tree
Showing 6 changed files with 722 additions and 183 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/msg-to-new-member-pr-merged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
types: [closed]
paths:
- 'TSC_MEMBERS.json'
- 'MAINTAINERS.yaml'

jobs:
welcome:
Expand All @@ -27,54 +27,57 @@ jobs:
- name: List of directory
run: ls -la
- run: cd community && git checkout HEAD^
- name: Install dependencies
run: npm install js-yaml@4.1.0
- name: Compare files
id: compare-files
uses: actions/github-script@v6
with:
script: |
const fs = require("fs");
const main_file = require('./community-main/TSC_MEMBERS.json');
const pr_file = require('./community/TSC_MEMBERS.json');
const yaml = require('js-yaml');
const main_file = yaml.load('./community-main/MAINTAINERS.yaml', 'utf8');
const pr_file = yaml.load('./community/MAINTAINERS.yaml', 'utf8');
const removed = pr_file.filter(
(newObj) => !main_file.some((oldObj) => oldObj.github === newObj.github)
);
const added = main_file.filter(
(oldObj) => !pr_file.some((newObj) => newObj.github === oldObj.github)
);
if(added.length > 0) {
core.info(`Added Contributors : ${JSON.stringify(added, null, 2)}`)
core.info(`Added Contributors:\n${yaml.dump(added)}`);
core.setOutput("newContributors", added.map((obj) => obj.github).join(","));
}
if(removed.length > 0) {
core.info(`Removed Contributors : ${JSON.stringify(removed, null, 2)}`)
core.info(`Removed Contributors:\n${yaml.dump(removed)}`);
core.setOutput("removed", "true");
}
core.info('TSC members in main branch:');
core.info(JSON.stringify(main_file, null, 2));
core.info('Location of TSC members in main branch:');
core.info(fs.realpathSync('./community-main/TSC_MEMBERS.json'));
core.info('TSC members in PR branch:');
core.info(JSON.stringify(pr_file, null, 2));
core.info('Location of TSC members in PR branch:');
core.info(fs.realpathSync('./community/TSC_MEMBERS.json'));
core.info('Maintainers in main branch:\n' + yaml.dump(main_file));
core.info('Location of Maintainers in main branch:');
core.info(fs.realpathSync('./community-main/MAINTAINERS.yaml'));
core.info('Maintainers in PR branch:\n' + yaml.dump(pr_file));
core.info('Location of Maintainers in PR branch:');
core.info(fs.realpathSync('./community/MAINTAINERS.yaml'));
- name: Set newMaintainers as environment variable
run: echo "newMaintainers=${{ steps.compare-files.outputs.newMaintainers }}" >> $GITHUB_ENV
- name: Debug newMaintainers output
run: |
echo "newMaintainers = $newMaintainers"
- name: Display welcome message
if: ${{steps.compare-files.outputs.newContributors != ''}}
if: env.newMaintainers != ''
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const newContributors = `${{steps.compare-files.outputs.newContributors}}`.split(",");
const welcomeMessage = newContributors.map((contributor) => `@${contributor.trim().replace(/^@/, '')} Soon you will be invited to join the AsyncAPI GitHub organization and you will be added to the team that lists all TSC members.
We use this team to mention in different discussions in different places in GitHub where TSC opinion is needed or even voting on some topic. Once TSC is mentioned:
const newMaintainers = process.env.newMaintainers.split(",");
const welcomeMessage = newMaintainers.map((maintainer) => `@${maintainer.trim().replace(/^@/, '')} I have invited you to join the AsyncAPI organization and you will soon be added to the team that lists all Maintainers.
We use this team to mention in different discussions in different places in GitHub where Maintainer's opinion is needed or even voting on some topic. Once Maintainers are mentioned:
- You get GitHub notification
- We also drop notification in our slack in #95_bot-tsc-members-mentioned channel
- We drop an email to people that subscribed to TSC news here https://www.asyncapi.com/community/tsc
- We also drop notification in our slack in #95_bot-maintainers-mentioned channel
- We drop an email to people that subscribed to Maintainer news here https://www.asyncapi.com/community/maintainers
Pick the channel for notifications that you prefer. Welcome aboard! We are excited to have you as part of the team.`).join("\n");
const { owner, repo } = context.repo;
const { number: issue_number } = context.issue;
return github.rest.issues.createComment({ owner, repo, issue_number, body: welcomeMessage });
Expand All @@ -84,5 +87,5 @@ jobs:
env:
SLACK_WEBHOOK: ${{secrets.SLACK_CI_FAIL_NOTIFY}}
SLACK_TITLE: 🚨 Welcome new contributor action failed 🚨
SLACK_MESSAGE: Failed to post a message to new TSC member
SLACK_MESSAGE: Failed to post a message to new Maintainer
MSG_MINIMAL: true
164 changes: 86 additions & 78 deletions .github/workflows/tsc_members_validator/schema.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,92 @@
{
"$id": "root",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"description": "List of all TSC members and information about them.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "Full name of the person, a nice human-readable name",
"examples": [
"Lukasz Gornicki"
]
},
"github": {
"type": "string",
"minLength": 1,
"description": "In must be a valid GitHub handle. It is used to provide a link to person's profile on GitHub and display profile picture on the AsyncAPI website",
"examples": [
"derberg"
]
},
"linkedin": {
"type": "string",
"minLength": 1,
"description": "Only LinkedIn profile name, everything you see after https://www.linkedin.com/in/ link. It is used on the AsyncAPI website to provide link to profile.",
"examples": [
"lukasz-gornicki-a621914"
]
},
"twitter": {
"type": "string",
"minLength": 1,
"description": "Twitter profile name. It is used on the AsyncAPI website to provide link to profile.",
"examples": [
"derberq"
]
},
"availableForHire": {
"type": "boolean",
"description": "It is not mandatory property as by default it is set to false. Nevertheless please add it, even if 'false' for better clarity. We use it on the AsyncAPI website to visually indicate that given person is available for hire.",
"default": false,
"examples": [
true,
false
]
},
"company": {
"$id": "root",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"description": "List of all maintainers and information about them.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "Full name of the person, a nice human-readable name",
"examples": [
"Lukasz Gornicki"
]
},
"github": {
"type": "string",
"minLength": 1,
"description": "It must be a valid GitHub handle. It is used to provide a link to the person's profile on GitHub and display the profile picture on the AsyncAPI website",
"examples": [
"derberg"
]
},
"linkedin": {
"type": "string",
"minLength": 1,
"description": "Only the LinkedIn profile name, everything you see after the https://www.linkedin.com/in/ link. It is used on the AsyncAPI website to provide a link to the profile.",
"examples": [
"lukasz-gornicki-a621914"
]
},
"twitter": {
"type": "string",
"minLength": 1,
"description": "Twitter profile name. It is used on the AsyncAPI website to provide a link to the profile.",
"examples": [
"derberq"
]
},
"availableForHire": {
"type": "boolean",
"description": "It is not a mandatory property as it is set to false by default. Nevertheless, please add it, even if 'false,' for better clarity. We use it on the AsyncAPI website to visually indicate whether the person is available for hire.",
"default": false,
"examples": [
true,
false
]
},
"company": {
"type": "string",
"minLength": 1,
"description": "It must be clear if the maintainer is affiliated with a company. AsyncAPI's open governance model allows no more than 1/4 of maintainers to be from the same company. If you are an individual contributor, you do not have to provide this property. In the UI, we will mark you as an individual contributor if this property is missing.",
"examples": [
"Postman"
]
},
"slack": {
"type": "string",
"description": "It must be a valid Slack ID. It is the ID of the person's profile in Slack",
"examples": [
"U01QPAP1QWE"
]
},
"repos": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"minLength": 1,
"description": "It must be clear if given TSC member is affiliated with some company. AsyncAPI's open governance model allows no more than 1/4 of TSC representatives from the same company. In case you are an individual contributor, you do not have to provide this property. In the UI we will mark you as individual contributor if this property is missing.",
"description": "List of repository names that must match the GitHub name of the repository. It is used to provide a link to the repository on the AsyncAPI website",
"examples": [
"Postman"
]
},
"slack":{
"type":"string",
"description": "It must be a valid slackID. It is the ID of the slack of the person 's profile",
"examples":[
"U01QPAP1QWE"
"avro-schema-parser"
]
},
"repos": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"description": "List of repositories names that must match the GitHub name of the repository. It is used to provide a link to the repository in AsyncAPI website",
"examples": [
"avro-schema-parser"
]
}
}
},
"required": [
"github",
"repos",
"slack"
],
"additionalProperties": false
}
}
"isTscMember": {
"type": "boolean",
"description": "Indicates whether the maintainer is a member of the technical steering committee",
"default": false,
"examples": [
true,
false
]
}
},
"required": [
"github",
"repos"
],
"additionalProperties": false
}
}
35 changes: 21 additions & 14 deletions .github/workflows/update-website-tsc.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#This action update the list of TSC members in the website repository. List of all TSC members is later rendered in the asyncapi.com website.
name: Update list of TSC members in the website repo

#This action update the list of TSC members in the website repository. List of all Maintainers is later rendered in the asyncapi.com website.
name: Update list of Maintainers in the website repo
on:
push:
branches:
- 'master'
- "master"
paths:
- 'TSC_MEMBERS.json'

- "MAINTAINERS.yaml"
jobs:
update-website:
name: Make PR on website repository with updated tsc members list
name: Make PR on website repository with updated maintainers list
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -29,21 +27,30 @@ jobs:
run: |
git config --global user.name asyncapi-bot
git config --global user.email info@asyncapi.io
- name: Create branch
working-directory: ./website
- name: Convert YAML to JSON using Python
working-directory: ./community
run: |
git checkout -b update-tscmembers-${{ github.head_ref }}
- name: Copy tsc members file from Current Repo to Another
python -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=4)' < MAINTAINERS.yaml > MAINTAINERS.json
- name: Copy maintainers file from Current Repo to Another
working-directory: ./website
run: |
cp ../community/TSC_MEMBERS.json ./config/TSC_MEMBERS.json
cp ../community/MAINTAINERS.json ./config/MAINTAINERS.json
- name: Commit and push
working-directory: ./website
run: |
git add .
git commit -m "docs(community): update latest tsc members list"
git commit -m "docs(community): update latest maintainers list"
git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website
- name: Create PR
working-directory: ./website
run: |
gh pr create --title "docs(community): update latest tsc members list" --body "Updated TSC members list is available and this PR introduces changes with latest information about TSC members" --head "update-tscmembers-${{ github.head_ref }}"
gh pr create --title "docs(community): update latest maintainers list" --body "Updated Maintainers list is available and this PR introduces changes with latest information about Maintainers" --head "update-tscmembers-${{ github.head_ref }}"
- name: Report workflow run status to Slack
if: failure() # Only, on failure, send a message on the slack channel
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_TITLE: 🚨 Update maintainers list action failed 🚨
SLACK_MESSAGE: Failed to update the maintainers list in the website repository.
MSG_MINIMAL: true
Loading

0 comments on commit 0f2ce62

Please sign in to comment.