Skip to content

Commit

Permalink
Merge pull request #105 from DSACMS/dev
Browse files Browse the repository at this point in the history
Merging Dev to Main
  • Loading branch information
natalialuzuriaga authored Jun 26, 2024
2 parents 465ed55 + 8b6f2ec commit 64b7c8b
Show file tree
Hide file tree
Showing 18 changed files with 316 additions and 29 deletions.
6 changes: 3 additions & 3 deletions tier0/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def addTopic():
]
subprocess.call(gh_cli_command)

if CREATE_REPO:
if CREATE_REPO == "True":
createGithubRepo()

if RECEIVE_UPDATES:
addTopic()
if RECEIVE_UPDATES == "True":
addTopic()
4 changes: 2 additions & 2 deletions tier1/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def addTopic():
]
subprocess.call(gh_cli_command)

if CREATE_REPO:
if CREATE_REPO == "True":
createGithubRepo()

if RECEIVE_UPDATES:
if RECEIVE_UPDATES == "True":
addTopic()
1 change: 1 addition & 0 deletions tier2/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"project_org": "DSACMS",
"project_repo_name": "{{ cookiecutter.project_name.lower().replace(' ', '-') }}",
"project_description": "This is the project description, could match github.com repo description.",
"code_owners": "Git usernames of code owners; separated by commas.",
"project_visibility": ["public", "internal", "private"],
"create_repo": [true, false],
"receive_updates": [true, false],
Expand Down
4 changes: 2 additions & 2 deletions tier2/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def addTopic():
]
subprocess.call(gh_cli_command)

if CREATE_REPO:
if CREATE_REPO == "True":
createGithubRepo()

if RECEIVE_UPDATES:
if RECEIVE_UPDATES == "True":
addTopic()
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
needs: resolve-repolinter-json
runs-on: ubuntu-latest
env:
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json}}
{% raw %}
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json }}
{% endraw %}
steps:
- uses: actions/checkout@v4
- run: echo $RAW_JSON > repolinter.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
workflow_dispatch:

jobs:
update-contributors:
runs-on: ubuntu-latest
name: Update contributors info in MAINTAINERS.md
permissions:
contents: write
pull-requests: write
steps:
# Update contributor list
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://github.com/marketplace/actions/contribute-list#optional-parameters
readme_path: MAINTAINERS.md
use_username: false
commit_message: "BOT: Update contributors info in MAINTAINERS.md"

# Update contributor count
- name: Checkout repository
uses: actions/checkout@v4

- name: Pull changes from contributors-readme-action
run: |
git pull
- name: Get repository contributors count
id: get_contributors
# https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors
# https://docs.github.com/en/graphql/reference/objects#repositorycollaboratorconnection
# https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#communicating-with-graphql
# CANNOT have newlines!
run: |
OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
QUERY='query { repository(owner: \"'"$OWNER"'\", name: \"'"$REPO"'\") { collaborators { totalCount } } }'
CONTRIBUTORS=$(curl -s -X POST -H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/json" -d "{\"query\": \"$QUERY\"}" https://api.github.com/graphql | jq -r '.data.repository.collaborators.totalCount')
echo "Total contributors: $CONTRIBUTORS"
echo "contributors=$CONTRIBUTORS" >> $GITHUB_OUTPUT
- name: Replace slug in MAINTAINERS.md with number of contributors
# https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed
run: |
CONTRIBUTORS=${{ steps.get_contributors.outputs.contributors }}
sed -i 's/<!--CONTRIBUTOR COUNT START-->.*<!--CONTRIBUTOR COUNT END-->/<!--CONTRIBUTOR COUNT START--> '"$CONTRIBUTORS"' <!--CONTRIBUTOR COUNT END-->/g' MAINTAINERS.md
- name: Commit and push changes
# https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
# commit changes, but if no changes exist, then exit cleanly
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add MAINTAINERS.md
git commit -m "BOT: Update contributors info in MAINTAINERS.md" || exit 0
git push
34 changes: 29 additions & 5 deletions tier2/{{cookiecutter.project_slug}}/CODEOWNERS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
# Code Owners
<!-- TODO: Who are the points of contact in your project who are responsible/accountable for the project? This can often be an engineering or design manager or leader, who may or may not be the primary maintainers of the project. List them by GitHub Username-->
{usernames of code owners}
{% set code_owners = cookiecutter.code_owners.split(',') %}
{% for item in code_owners %}- {{ item }}
{% endfor %}

# Repo Domains
<!-- TODO: List out the various domains of the project or teams of owners for that domain (e.g. Frontend, Backend, Documentation)-->
documentation/* {usernames of documentation owners}
frontend/* {usernames of frontend owners}
## Repo Domains

<!--
The Repo Domains section of your CODEOWNERS.md file helps manage code review responsibilities efficiently. Each domain represents a different aspect of the repository, such as documentation, frontend, backend, DevOps, testing, etc. In this section, list each domain and assign the appropriate GitHub usernames or teams responsible for that domain. This ensures that pull requests (PRs) are reviewed by the right experts, maintaining high code quality and relevance.
For example:
/docs/ @doc-team @johnsmith @janedoe
/frontend/ @frontend-team @alice @bob
/backend/ @backend-team @charlie @dana
Furthermore, GitHub teams are a good feature for managing groups of contributors who need to be notified about specific domains within a repository. By creating and using GitHub teams, you can allow contributors to ping multiple relevant experts simultaneously.
To set up GitHub teams:
- Navigate to your organization's settings and select "Teams".
- Create a new team for each domain, such as @frontend-team, @backend-team, or @doc-team.
- Add the relevant members to each team. Ensure that the team includes all the individuals who should be notified about PRs in their domain.
- When filling out the Repo Domains section in your CODEOWNERS.md file, use the team handles instead of or alongside individual usernames. This way, when a contributor opens a PR affecting a specific domain, they can simply tag the team, and every member of that team will be notified.
-->

/docs/ {Git usernames of documentation owners}
/frontend/ {Git usernames of frontend owners}
6 changes: 6 additions & 0 deletions tier2/{{cookiecutter.project_slug}}/MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ This is a list of maintainers for this project. See [CODEOWNERS.md](./CODEOWNERS
|:-----|:-----|:-----|:-----|
| {role} | {names} | {github usernames} | {affiliations}|

## Contributors

Total number of contributors: <!--CONTRIBUTOR COUNT START--> <!--CONTRIBUTOR COUNT END-->

<!-- readme: contributors -start -->
<!-- readme: contributors -end -->
1 change: 1 addition & 0 deletions tier3/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"project_org": "DSACMS",
"project_repo_name": "{{ cookiecutter.project_name.lower().replace(' ', '-') }}",
"project_description": "This is the project description, could match github.com repo description.",
"code_owners": "Git usernames of code owners; separated by commas.",
"project_visibility": ["public", "internal", "private"],
"create_repo": [true, false],
"receive_updates": [true, false],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
needs: resolve-repolinter-json
runs-on: ubuntu-latest
env:
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json}}
{% raw %}
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json }}
{% endraw %}
steps:
- uses: actions/checkout@v4
- run: echo $RAW_JSON > repolinter.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
workflow_dispatch:

jobs:
update-contributors:
runs-on: ubuntu-latest
name: Update contributors info in MAINTAINERS.md
permissions:
contents: write
pull-requests: write
steps:
# Update contributor list
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://github.com/marketplace/actions/contribute-list#optional-parameters
readme_path: MAINTAINERS.md
use_username: false
commit_message: "BOT: Update contributors info in MAINTAINERS.md"

# Update contributor count
- name: Checkout repository
uses: actions/checkout@v4

- name: Pull changes from contributors-readme-action
run: |
git pull
- name: Get repository contributors count
id: get_contributors
# https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors
# https://docs.github.com/en/graphql/reference/objects#repositorycollaboratorconnection
# https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#communicating-with-graphql
# CANNOT have newlines!
run: |
OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
QUERY='query { repository(owner: \"'"$OWNER"'\", name: \"'"$REPO"'\") { collaborators { totalCount } } }'
CONTRIBUTORS=$(curl -s -X POST -H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/json" -d "{\"query\": \"$QUERY\"}" https://api.github.com/graphql | jq -r '.data.repository.collaborators.totalCount')
echo "Total contributors: $CONTRIBUTORS"
echo "contributors=$CONTRIBUTORS" >> $GITHUB_OUTPUT
- name: Replace slug in MAINTAINERS.md with number of contributors
# https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed
run: |
CONTRIBUTORS=${{ steps.get_contributors.outputs.contributors }}
sed -i 's/<!--CONTRIBUTOR COUNT START-->.*<!--CONTRIBUTOR COUNT END-->/<!--CONTRIBUTOR COUNT START--> '"$CONTRIBUTORS"' <!--CONTRIBUTOR COUNT END-->/g' MAINTAINERS.md
- name: Commit and push changes
# https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
# commit changes, but if no changes exist, then exit cleanly
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add MAINTAINERS.md
git commit -m "BOT: Update contributors info in MAINTAINERS.md" || exit 0
git push
34 changes: 29 additions & 5 deletions tier3/{{cookiecutter.project_slug}}/CODEOWNERS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
# Code Owners
<!-- TODO: Who are the points of contact in your project who are responsible/accountable for the project? This can often be an engineering or design manager or leader, who may or may not be the primary maintainers of the project. List them by GitHub Username-->
{usernames of code owners}
{% set code_owners = cookiecutter.code_owners.split(',') %}
{% for item in code_owners %}- {{ item }}
{% endfor %}

# Repo Domains
<!-- TODO: List out the various domains of the project or teams of owners for that domain (e.g. Frontend, Backend, Documentation)-->
documentation/* {usernames of documentation owners}
frontend/* {usernames of frontend owners}
## Repo Domains

<!--
The Repo Domains section of your CODEOWNERS.md file helps manage code review responsibilities efficiently. Each domain represents a different aspect of the repository, such as documentation, frontend, backend, DevOps, testing, etc. In this section, list each domain and assign the appropriate GitHub usernames or teams responsible for that domain. This ensures that pull requests (PRs) are reviewed by the right experts, maintaining high code quality and relevance.
For example:
/docs/ @doc-team @johnsmith @janedoe
/frontend/ @frontend-team @alice @bob
/backend/ @backend-team @charlie @dana
Furthermore, GitHub teams are a good feature for managing groups of contributors who need to be notified about specific domains within a repository. By creating and using GitHub teams, you can allow contributors to ping multiple relevant experts simultaneously.
To set up GitHub teams:
- Navigate to your organization's settings and select "Teams".
- Create a new team for each domain, such as @frontend-team, @backend-team, or @doc-team.
- Add the relevant members to each team. Ensure that the team includes all the individuals who should be notified about PRs in their domain.
- When filling out the Repo Domains section in your CODEOWNERS.md file, use the team handles instead of or alongside individual usernames. This way, when a contributor opens a PR affecting a specific domain, they can simply tag the team, and every member of that team will be notified.
-->

/docs/ {Git usernames of documentation owners}
/frontend/ {Git usernames of frontend owners}
9 changes: 8 additions & 1 deletion tier3/{{cookiecutter.project_slug}}/MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ This is a list of maintainers for this project. See [CODEOWNERS.md](./CODEOWNERS
| member | active contributor in the community | multiple contributions to the project. | PROJECT GitHub org Committer Team|
| reviewer | review contributions from other members | history of review and authorship in a subproject | MAINTAINERS file reviewer entry, and GitHub Org Triage Team|
| approver | approve accepting contributions | highly experienced and active reviewer + contributor to a subproject | MAINTAINERS file approver entry and GitHub Triage Team |
| lead | set direction and priorities for a subproject | demonstrated responsibility and excellent technical judgement for the subproject | MAINTAINERS file owner entry and GitHub Org Admin Team|
| lead | set direction and priorities for a subproject | demonstrated responsibility and excellent technical judgement for the subproject | MAINTAINERS file owner entry and GitHub Org Admin Team|

## Contributors

Total number of contributors: <!--CONTRIBUTOR COUNT START--> <!--CONTRIBUTOR COUNT END-->

<!-- readme: contributors -start -->
<!-- readme: contributors -end -->
1 change: 1 addition & 0 deletions tier4/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"project_org": "DSACMS",
"project_repo_name": "{{ cookiecutter.project_name.lower().replace(' ', '-') }}",
"project_description": "This is the project description, could match github.com repo description.",
"code_owners": "Git usernames of code owners; separated by commas.",
"project_visibility": ["public", "internal", "private"],
"create_repo": [true, false],
"receive_updates": [true, false],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
needs: resolve-repolinter-json
runs-on: ubuntu-latest
env:
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json}}
{% raw %}
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json }}
{% endraw %}
steps:
- uses: actions/checkout@v4
- run: echo $RAW_JSON > repolinter.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
workflow_dispatch:

jobs:
update-contributors:
runs-on: ubuntu-latest
name: Update contributors info in MAINTAINERS.md
permissions:
contents: write
pull-requests: write
steps:
# Update contributor list
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://github.com/marketplace/actions/contribute-list#optional-parameters
readme_path: MAINTAINERS.md
use_username: false
commit_message: "BOT: Update contributors info in MAINTAINERS.md"

# Update contributor count
- name: Checkout repository
uses: actions/checkout@v4

- name: Pull changes from contributors-readme-action
run: |
git pull
- name: Get repository contributors count
id: get_contributors
# https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors
# https://docs.github.com/en/graphql/reference/objects#repositorycollaboratorconnection
# https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#communicating-with-graphql
# CANNOT have newlines!
run: |
OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
QUERY='query { repository(owner: \"'"$OWNER"'\", name: \"'"$REPO"'\") { collaborators { totalCount } } }'
CONTRIBUTORS=$(curl -s -X POST -H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/json" -d "{\"query\": \"$QUERY\"}" https://api.github.com/graphql | jq -r '.data.repository.collaborators.totalCount')
echo "Total contributors: $CONTRIBUTORS"
echo "contributors=$CONTRIBUTORS" >> $GITHUB_OUTPUT
- name: Replace slug in MAINTAINERS.md with number of contributors
# https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed
run: |
CONTRIBUTORS=${{ steps.get_contributors.outputs.contributors }}
sed -i 's/<!--CONTRIBUTOR COUNT START-->.*<!--CONTRIBUTOR COUNT END-->/<!--CONTRIBUTOR COUNT START--> '"$CONTRIBUTORS"' <!--CONTRIBUTOR COUNT END-->/g' MAINTAINERS.md
- name: Commit and push changes
# https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
# commit changes, but if no changes exist, then exit cleanly
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add MAINTAINERS.md
git commit -m "BOT: Update contributors info in MAINTAINERS.md" || exit 0
git push
Loading

0 comments on commit 64b7c8b

Please sign in to comment.