Skip to content

Commit 249eba6

Browse files
committed
Work in progress
1 parent d018c6e commit 249eba6

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
username: zackkrida
2+
---
3+
name: Zack Krida
4+
---
5+
md5_hashed_email: 9b97b0b4796e00b366a3855f46659a77
6+
---
7+
about:
8+
[Zack](https://creativecommons.org/author/zack-krida/) is the primary open-source maintainer and front-end engineer of the CC Search front end. He's `@zackkrida` on the CC Slack and [GitHub](https://github.com/zackkrida).
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
title: Automate GitHub for more than CI/CD
2+
---
3+
categories:
4+
community
5+
cc-search
6+
open-source
7+
---
8+
author: zackkrida
9+
---
10+
pub_date: 2020-08-26
11+
---
12+
body:
13+
14+
> *Get started using GitHub bots and actions for community management and repositiory health.*
15+
16+
17+
In late 2018, in the midst of being acquired by Microsoft, GitHub [launched Github Actions](https://github.blog/2018-10-16-future-of-software/) into public beta, allowing users to run code on the popular development platform for the first time. With a straightforward `.yml` configuration syntax and the power of Microsoft's Azure cloud, GitHub actions quickly rose to compete with existing Continuous Integration (CI) and Continuous Deployment (CD) platforms like **Circle CI** and **Travis CI**. GitHub actions made it easier than ever for developers to test and deploy software in the cloud, but from the beginning GitHub had bigger plans for the service.
18+
19+
In a [2018 TechCrunch interview](https://techcrunch.com/2018/10/16/github-launches-actions-its-workflow-automation-tool/), GitHub's then head of platform adknowledged the usefullness of actions for more than CI/CD. "I see CI/CD as one narrow use case of actions. It’s so, so much more,” Lambert stressed. “And I think it’s going to revolutionize DevOps because people are now going to build best in breed deployment workflows for specific applications and frameworks, and those become the de facto standard shared on GitHub. [] It’s going to do everything we did for open source again for the DevOps space and for all those different parts of that workflow ecosystem."
20+
21+
At Creative Commons, we use Github Actions and Bots on many of [our open-source projects](https://github.com/creativecommons?type=source) for more than CI/CD—to manage our [community team](http://localhost:5000/community/community-team/); to automate repository health; and to make tedious but frequent tasks automatic. The following examples are just a small snapshot of our existing and in-progress automations.
22+
23+
## Example automations
24+
25+
<!-- no toc -->
26+
- [Automatic release note generation](#automatic-release-note-generation)
27+
- [Repository Normalization](#repository-normalization)
28+
- [Automatic Dependency Updates](#automatic-dependency-updates)
29+
30+
### Automatic release note generation
31+
32+
Our frontend Vue.js application for CC Search gets released weekly, and is subject to constant pull requests from myself, one-time volunteers making their first open source contribution, and long-term, dedicated community members who frequently contribute. It's important for us to highlight *all* of these contributions in our release notes, regardless of size or scope. Additionally, we find it useful to group changes into categories, so our users have a clear sense of what kinds of updates we've made.
33+
34+
<div style="text-align: center;">
35+
<figure class="margin-bottom-large">
36+
<img src="release-notes-screenshot.png" alt="GitHub screenshot of release notes for CC Search" />
37+
<figcaption>
38+
<em>
39+
An example of CC Search release notes generated by the <a href="https://github.com/marketplace/actions/release-drafter">Release Drafter</a> GitHub Action.
40+
</em>
41+
</figcaption>
42+
</figure>
43+
</div>
44+
45+
The quality of these release notes made them quite tedious to generate manually. With the [release drafter action](https://github.com/marketplace/actions/release-drafter), we're able to automatically update a draft release note on every pull request to CC Search. The action lets us configure the line added for each pull request with some basic templating which includes variables for the pr number, title, and author (among others):
46+
47+
```yaml
48+
change-template: '- $TITLE: #$NUMBER by @$AUTHOR'
49+
```
50+
51+
<br />We can also map GitHub labels on our pull requests to the sections of our generated release notes, like so:
52+
53+
```yaml
54+
categories:
55+
- title: 'New Features'
56+
label: 'feature'
57+
- title: 'Bug Fixes'
58+
label:
59+
- 'bug'
60+
- 'critical'
61+
```
62+
63+
The resulting release notes require no manual editing at release time, and has saved us hours over time and allows our developers to focus on DevOps work instead of copywriting on release days. We also never miss a contribution or expression of gratitude to one of our contributors. You can read the [latest CC Search release notes](https://github.com/creativecommons/cccatalog-frontend/releases/latest) or [see our full release-drafter.yml file here](https://github.com/creativecommons/cccatalog-frontend/blob/develop/.github/release-drafter.yml).
64+
65+
### Repository Normalization
66+
67+
Within a private repository of internal helper scripts, the CC technical team has a number of Github Actions which trigger python scripts to keep configuration standardized across our repositories. One such script ensures that we use a standard set of GitHub labels across all of our projects. This consistency helps us do things like direct users to [open issues in need of assistance](https://github.com/search?q=org%3Acreativecommons+label%3A%22help+wanted%22+state%3Aopen&type=Issues) across the organization, or issues [good for first-time open source contributors](https://github.com/search?q=org%3Acreativecommons+label%3A%22good+first+issue%22+state%3Aopen&type=Issues). With GitHub actions, its easy to set up scheduled tasks with only a few lines of human-readable configuration. Here's the gist of running a python script daily, for example:
68+
69+
```yaml
70+
name: Example scheduled python action
71+
on:
72+
schedule:
73+
- cron: '0 0 * * *'
74+
push:
75+
branches:
76+
- master
77+
jobs:
78+
build:
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v2
82+
- name: Set up Python 3.7
83+
uses: actions/setup-python@v1
84+
with:
85+
python-version: 3.7
86+
- name: Install dependencies
87+
run: |
88+
python -m pip install --upgrade pip
89+
python -m pip install pipenv
90+
pipenv install
91+
- name: Export token to env and run our script
92+
run: |
93+
pipenv run python our-script.py
94+
env:
95+
ADMIN_GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
96+
```
97+
98+
Internally and publically, we use [GitHub Projects](https://github.com/orgs/creativecommons/projects) to manage our bi-weekly sprints and backlogs. The [GitHub Project Bot](https://github.com/subhamX/github-project-bot) action allows to add pull requests to our progress columns. Here's an example step in such a job:
99+
100+
```yaml
101+
- name: Handle cccatalog-frontend Repo
102+
uses: subhamX/github-project-bot@v1.0.0
103+
with:
104+
ACCESS_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
105+
COLUMN_NAME: "In Progress (Community)"
106+
PROJECT_URL: https://github.com/orgs/creativecommons/projects/7
107+
REPO_URL: https://github.com/creativecommons/cccatalog-frontend
108+
```
109+
110+
We have additional scripts that sync our community team members across our open source website and GitHub, and several others that do even more of this cross-platform synchronization work. All of these scripts relive significant burden off of our engineering manager and open source community coordinator.
111+
112+
### Automatic Depedency Updates
113+
114+
[tbd]
115+
116+
## conslusion
117+
118+
- github actions rule
119+
- finedmore here
120+
- share your ideas with us
243 KB
Loading

0 commit comments

Comments
 (0)