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

Update .github repo to Tier 3 Repository Template #4

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "run-linting-checks"
on:
pull_request:
branches: [main, dev]


jobs:
resolve-repolinter-json:
uses: DSACMS/repo-scaffolder/.github/workflows/extendJSONFile.yml@add-repolinter-workflows
with:
url_to_json: 'https://raw.githubusercontent.com/DSACMS/repo-scaffolder/main/tier3/%7B%7Bcookiecutter.project_slug%7D%7D/repolinter.json'

repolinter-checks:
name: Tier 3 Checks
needs: resolve-repolinter-json
runs-on: ubuntu-latest
env:
{% raw %}
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json }}
{% endraw %}
steps:
- uses: actions/checkout@v4
- run: echo $RAW_JSON > repolinter.json
- uses: newrelic/repolinter-action@v1
with:
# A path to the JSON/YAML Repolinter ruleset to use, relative to the workflow
# working directory (i.e. under `$GITHUB_WORKSPACE`).
#
# This option is mutually exclusive with config_url. If this option and
# config_url are not specified, Repolinter's default ruleset will be used.
config_file: 'repolinter.json'

# Where repolinter-action should put the linting results. There are two
# options available:
# * "exit-code": repolinter-action will print the lint output to the console
# and set the exit code to result.passed. This output type is most useful for
# PR status checks.
# * "issue": repolinter-action will create a GitHub issue on the current
# repository with the repolinter output and always exit 0. See the README for
# more details on issue outputting behavior. This output type is ideal for
# non-intrusive notification.
#
# Default: "exit-code"
output_type: 'issue'

# The title to use for the issue created by repolinter-action. This title
# should indicate the purpose of the issue, as well as that it was created by
# a bot.
#
# This option will be ignored if output_type != "issue".
#
# Default: "[Repolinter] Open Source Policy Issues"
output_name: '[Repolinter] Tier 3 Repository Hygiene Issue'

# The name to use for the issue label created by repolinter-action. This name
# should be unique to repolinter-action (i.e. not used by any other issue) to
# prevent repolinter-action from getting confused.
#
# This option will be ignored if output_type != "issue".
#
# Default: "repolinter"
label_name: 'cms-oss-tier3'

# The color to use for the issue label created by repolinter-action. The value
# for this option should be an unprefixed RRGGBB hex string (ex. ff568a).
# The default value is a shade of yellow.
#
# This option will be ignored if output_type != "issue".
#
# Default: "fbca04"
label_color: 'ff69b4'
68 changes: 68 additions & 0 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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:
{% raw %}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
{% endraw %}
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: |
{% raw %}
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
{% endraw %}

- 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: |
{% raw %}
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
{% endraw %}

- 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
37 changes: 37 additions & 0 deletions .github/workflows/repoStructure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- main
workflow_dispatch:

jobs:
populate-repo-structure:
runs-on: ubuntu-latest
name: Update repo structure in README.md
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Populate repository structure with tree command
# https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed
# https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern
run: |
quoteSubst() {
IFS= read -d '' -r < <(sed -e ':a' -e '$!{N;ba' -e '}' -e 's/[&/\]/\\&/g; s/\n/\\&/g' <<<"$1")
printf %s "${REPLY%$'\n'}"
}
TREE_OUTPUT=$(tree -d)
sed -i 's/<!--TREE START--><!--TREE END-->/\n```plaintext\n'"$(quoteSubst $TREE_OUTPUT)"'\n```\n/g' README.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 README.md
git commit -m "BOT: Update repo structure in README.md" || exit 0
git push
6 changes: 0 additions & 6 deletions .gitignore

This file was deleted.

32 changes: 32 additions & 0 deletions CODEOWNERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +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-->
{% set code_owners = cookiecutter.code_owners.split(',') %}
{% for item in code_owners %}- {{ item }}
{% endfor %}

## 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}
17 changes: 17 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity, expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers at [email protected].

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)

## Acknowledgements

This CODE_OF_CONDUCT.md was originally forked from the [United States Digital Service](https://usds.gov) [Justice40](https://thejustice40.com) open source [repository](https://github.com/usds/justice40-tool), and we would like to acknowledge and thank the community for their contributions.
37 changes: 37 additions & 0 deletions COMMUNITY_GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# {{ cookiecutter.project_name }} Open Source Community Guidelines

This document contains principles and guidelines for participating in the {{ cookiecutter.project_name }} open source community.

## Principles

These principles guide our data, product, and process decisions, architecture, and approach.

- Open means transparent and participatory.
- We take a modular and modern approach to software development.
- We build open-source software and open-source process.
- We value ease of implementation.
- Fostering community includes building capacity and making our software and processes accessible to participants with diverse backgrounds and skillsets.
- Data (and data science) is as important as software and process. We build open data sets where possible.
- We strive for transparency for algorithms and places we might be introducing bias.

## Community Guidelines

All community members are expected to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md).

Information on contributing to this repository is available in our [Contributing file](CONTRIBUTING.md).

When participating in {{ cookiecutter.project_name }} open source community conversations and spaces, we ask individuals to follow the following guidelines:

- When joining a conversation for the first time, please introduce yourself by providing a brief intro that includes:
- your related organization (if applicable)
- your pronouns
- your superpower, and how you hope to use it for {{ cookiecutter.project_name }}
- Embrace a culture of learning, and educate each other. We are all entering this conversation from different starting points and with different backgrounds. There are no dumb questions.
- Take space and give space. We strive to create an equitable environment in which all are welcome and able to participate. We hope individuals feel comfortable voicing their opinions and providing contributions and will do our best to recognize and make space for individuals who may be struggling to find space here. Likewise, we expect individuals to recognize when they are taking up significant space and take a step back to allow room for others.
<!-- TODO: Add if your repo has a community chat - Be present when joining synchronous conversations such as our community chat. Why be here if you're not going to _be here_? -->
- Be respectful.
- Default to positive. Assume others' contributions are legitimate and valuable and that they are made with good intention.

## Acknowledgements

This COMMUNITY_GUIDELINES.md was originally forked from the [United States Digital Service](https://usds.gov) [Justice40](https://thejustice40.com) open source [repository](https://github.com/usds/justice40-tool), and we would like to acknowledge and thank the community for their contributions.
Loading