These are scripts used to maintain various pieces of CC's open source community infrastructure.
The Creative Commons team is committed to fostering a welcoming community. This project and all other Creative Commons open source projects are governed by our Code of Conduct. Please report unacceptable behavior to conduct@creativecommons.org per our reporting guidelines.
See CONTRIBUTING.md.
The following workflows are ordered by schedule frequency and start time.
| Workflow | ||
|---|---|---|
| Schedule: | Hourly at 30 minutes past the hour (**:30) |
|
| YAML: | sync_community_teams.yml |
|
| Script | ||
| File: | sync_community_teams.py |
|
| Common Modules: | ccos/ |
|
| Specific Modules: | ccos/norm/ |
|
| Env | ||
| Required: | ADMIN_GITHUB_TOKEN |
This creates GitHub teams for the Community teams and updates their membership
based on the community_team_members.json Lektor databag.
- The databag is used to:
- create the Community Team Members — Creative Commons Open Source page
- configure GitHub team memberships and repository permissions
- The databag is kept up-to-date by Push data to CC Open Source, below
| Workflow | ||
|---|---|---|
| Schedule: | Hourly at 45 minutes past the hour (**:45) |
|
| YAML: | manage_issues.yml |
|
| Script | ||
| File: | manage_new_issues_and_pull_requests.py |
|
| Common Modules: | ccos/ |
|
| Env | ||
| Required: | ADMIN_GITHUB_TOKEN |
This manages new issues and pull requests to ensure they are properly tracked in a GitHub project:
- possumbilities project: Web Development and Web Support
- Shafiya-Heena project: IT Support, Platforms, and Systems
- TimidRobot project: Application Programming and Management
| Workflow | ||
|---|---|---|
| Schedule: | Hourly at 45 minutes past the hour (**:45) |
|
| YAML: | normalize_repos.yml |
|
| Script | ||
| File: | normalize_repos.py |
|
| Common Modules: | ccos/ |
|
| Specific Modules: | ccos/norm/ |
|
| Env | ||
| Required: | ADMIN_GITHUB_TOKEN |
This ensures that all active repositories in the creativecommons GitHub organization are consistent in the following ways:
- They have all the labels defined in
labels.ymlpresent. - They have standard branch protections set up (with some exceptions).
This will only update color and description of existing labels or create new labels. It will never delete labels.
| Workflow | ||
|---|---|---|
| Schedule: | Daily at midnight:15 (00:15) |
|
| YAML: | push_data_to_ccos.yml |
|
| Script | ||
| File: | push_data_to_ccos.py |
|
| Common Modules: | ccos/ |
|
| Specific Modules: | ccos/data/ |
|
| Env | ||
| Required: | ADMIN_ASANA_TOKEN |
|
| Required: | ADMIN_GITHUB_TOKEN |
This retreives data from Asana, formats it as a lektor databag, and pushes it to CC Open Source website source repository:
- Data Source: Community Team Tracking - Asana (limited access)
- Data Destination:
The destination data is used by the following pages:
- Community Team Members — Creative Commons Open Source
- Open Source Projects — Creative Commons Open Source
| Workflow | ||
|---|---|---|
| Schedule: | Monthly on the 1st at 22:22 | |
| YAML: | enable_workflows.yml |
|
| Script | ||
| File: | enable_workflows.py |
|
| Common Modules: | ccos/ |
|
| Env | ||
| Required: | ADMIN_GITHUB_TOKEN |
Enable GitHub Action workflows for specified repositories (ensures that they are not disabled due to inactivity).
For more information, see Prevent scheduled GitHub Actions from becoming disabled - Stack Overflow.
ADMIN_ASANA_TOKEN: Asana token with access to the Creative Commons Asana organizationADMIN_GITHUB_TOKEN: GitHub token with admin permissions to thecreativecommonsGitHub organization
Scripts that commit code or automatically reply to pull requests and issues need to be associated with a GitHub user account. Creative Commons maintains a cc-open-source-bot user for this purpose. This is useful for a few reasons:
- It's ethically important that our community members know when they are talking to a bot instead of a human.
- It makes it easy to audit our automations in the future, because all commits and messages will be associated with the single @cc-open-source-bot user account via the GitHub search, api, etc.
- We won't need to update automations when there are changes to staff or volunteers.
Using this bot clearly communicates when a commit, comment, or action was performed by an automation. For example, here is some configuration for a workflow using the Add & Commit GitHub Action:
# ...other settings here
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: cc-open-source-bot
author_email: opensource@creativecommons.org
message: "Deploy site"
add: "./example-directory"Local development and testing is facilitated by helper scripts:
./dev/tools.sh: Checks and updates Python formatting.dev/test.sh: Uses act and Docker to test workflows- nektos/act: Run your GitHub Actions locally 🚀
- Asana/python-asana: Official Python client library for the Asana API v1
- carpedm20/emoji: e_moji terminal output for Python
- gitpython-developers/GitPython: GitPython is a python library used to interact with Git repositories.
- graphql-python/gql: A GraphQL client in Python
- PyGithub/PyGithub: Typed interactions with the GitHub API v3
- PyYAML: a full-featured YAML framework for the Python programming language
- Requests: HTTP for Humans™
The GitHub GraphQL API public schema
(ccos/schema.docs.graphql) was downloaded from Public
schema - GitHub Docs and is not within scope of the Expat/MIT
license of this project.