Skip to content

Commit

Permalink
Merge pull request #1 from DSACMS/outbound-docs
Browse files Browse the repository at this point in the history
Add Source Code and Docs to gource-log GitHub Action
  • Loading branch information
IsaacMilarky authored Nov 7, 2024
2 parents 2aef574 + 43aff1d commit 0fb5448
Show file tree
Hide file tree
Showing 17 changed files with 321 additions and 127 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!Dockerfile
!entrypoint.py
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Issue Report

module-name: One line summary of the issue (less than 72 characters)

### Expected behavior

As concisely as possible, describe the expected behavior.

### Actual behavior

As concisely as possible, describe the observed behavior.

### Steps to reproduce the behavior

List all relevant steps to reproduce the observed behavior.
49 changes: 49 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--
Thank you for sending the PR! We appreciate you spending the time to work on
these changes.
Help us understand your motivation by explaining why you decided to make this change.
Happy contributing!
- Comments should be formatted to a width no greater than 80 columns.
- Files should be exempt of trailing spaces.
- We adhere to a specific format for commit messages. Please write your commit
messages along these guidelines. Please keep the line width no greater than 80
columns (You can use `fmt -n -p -w 80` to accomplish this).
-->

## module-name: One line description of your change (less than 72 characters)

## Problem

Explain the context and why you're making that change. What is the problem
you're trying to solve? In some cases there is not a problem and this can be
thought of being the motivation for your change.

## Solution

Describe the modifications you've done.

## Result

What will change as a result of your pull request? Note that sometimes this
section is unnecessary because it is self-explanatory based on the solution.

Some important notes regarding the summary line:

* Describe what was done; not the result
* Use the active voice
* Use the present tense
* Capitalize properly
* Do not end in a period — this is a title/subject
* Prefix the subject with its scope

## Test Plan

(Write your test plan here. If you changed any code, please provide us with
clear instructions on how you verified your changes work.)
File renamed without changes.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
target-branch: "main"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "main"
schedule:
interval: "daily"
27 changes: 27 additions & 0 deletions .github/workflows/auto_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Merge main into dev

on:
push:
branches:
- main

jobs:
update-dev:
permissions: write-all
name: update-dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git config user.name 'GitHub Actions'
git config user.email '[email protected]'
git checkout dev
git merge main
echo "Done with merge"
- name: Push to dev
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: dev
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Verify that the Docker image for the action builds
run: sudo docker build . --file Dockerfile

- name: Integration test
id: integration
uses: ./

49 changes: 1 addition & 48 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
on:
push:
branches:
- main
workflow_dispatch:

jobs:
Expand All @@ -16,53 +13,9 @@ jobs:
- 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
commit_message: "BOT: Update contributors info in MAINTAINERS.md"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__/
tests/__pycache__/
*.pyc
72 changes: 20 additions & 52 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,30 @@ We encourage you to read this project's CONTRIBUTING policy (you are here), its

## Getting Started

<!--- TODO: If you have 'good-first-issue' or 'easy' labels for newcomers, mention them here.-->
To use this GitHub action, you should be able to use it in your existing GitHub workflow. To test the action locally, you can use the act project to build and run the action locally.

### Team Specific Guidelines
### Installation

<!-- TODO: This section helps contributors understand any team structure in the project (formal or informal.) Encouraged to point towards the MAINTAINERS.md file for further details.-->
1. Clone the repo

### Building dependencies
`git clone https://github.com/IsaacMilarky/gource-log.git`

<!--- TODO: This step is often skipped, so don't forget to include the steps needed to install on your platform. If you project can be multi-platform, this is an excellent place for first time contributors to send patches!-->
2. Install the required packages and build dependencies:

- Docker
- act
- gource

### Building the Project

<!--- TODO: Be sure to include build scripts and instructions, not just the source code itself! -->
1. Change to the base project directory

2. Run the 'build' job using act

`sudo act -a build`

### Workflow and Branching

<!--- TODO: Workflow Example
We follow the [GitHub Flow Workflow](https://guides.github.com/introduction/flow/)

1. Fork the project
Expand All @@ -42,27 +49,10 @@ We follow the [GitHub Flow Workflow](https://guides.github.com/introduction/flow
6. Work with repo maintainers to get your change reviewed
7. Wait for your change to be pulled into `DSACMS/gource-log/main`
8. Delete your feature branch
-->

### Testing Conventions

<!--- TODO: Discuss where tests can be found, how they are run, and what kind of tests/coverage strategy and goals the project has. -->

### Coding Style and Linters

<!--- TODO: HIGHLY ENCOURAGED. Specific tools will vary between different languages/frameworks (e.g. Black for python, eslint for JavaScript, etc...)
1. Mention any style guides you adhere to (e.g. pep8, etc...)
2. Mention any linters your project uses (e.g. flake8, jslint, etc...)
3. Mention any naming conventions your project uses (e.g. Semantic Versioning, CamelCasing, etc...)
4. Mention any other content guidelines the project adheres to (e.g. plainlanguage.gov, etc...)
-->

### Writing Issues

<!--- TODO: Example Issue Guides
When creating an issue please try to adhere to the following format:

module-name: One line summary of the issue (less than 72 characters)
Expand All @@ -80,11 +70,9 @@ When creating an issue please try to adhere to the following format:
List all relevant steps to reproduce the observed behavior.

see our .github/ISSUE_TEMPLATE.md for more examples.
-->

### Writing Pull Requests

<!-- TODO: Make a brief statement about where to file pull/merge requests, and conventions for doing so. Link to PULL_REQUEST_TEMPLATE.md file.
### Writing Pull Requests

Comments should be formatted to a width no greater than 80 columns.

Expand Down Expand Up @@ -121,44 +109,24 @@ Some important notes regarding the summary line:
* Prefix the subject with its scope

see our .github/PULL_REQUEST_TEMPLATE.md for more examples.
-->

## Reviewing Pull Requests

<!--- TODO: Make a brief statement about how pull-requests are reviewed, and who is doing the reviewing. Linking to MAINTAINERS.md can help.
Code Review Example
The repository on GitHub is kept in sync with an internal repository at
github.cms.gov. For the most part this process should be transparent to the
project users, but it does have some implications for how pull requests are
merged into the codebase.

When you submit a pull request on GitHub, it will be reviewed by the project
community (both inside and outside of github.cms.gov), and once the changes are
approved, your commits will be brought into github.cms.gov's internal system for
additional testing. Once the changes are merged internally, they will be pushed
back to GitHub with the next sync.
This process means that the pull request will not be merged in the usual way.
Instead a member of the project team will post a message in the pull request
thread when your changes have made their way back to GitHub, and the pull
request will be closed.
The changes in the pull request will be collapsed into a single commit, but the
authorship metadata will be preserved.
-->
maintainers, and once the changes are approved, your commits will be brought into
the dev branch for additional testing. Once the changes are merged internally,
they will be pushed back to GitHub main with the next sync.

<!--
## Shipping Releases
<!-- TODO: What cadence does your project ship new releases? (e.g. one-time, ad-hoc, periodically, upon merge of new patches) Who does so?
-->

<!-- TODO: Documentation Example
## Documentation
<!-- TODO: Documentation Example
We also welcome improvements to the project documentation or to the existing
docs. Please file an [issue](https://github.com/DSACMS/gource-log/issues).
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# If you need Python 3 and the GitHub CLI, then use:
FROM cicirello/pyaction:4

# If all you need is Python 3, use:
# FROM cicirello/pyaction-lite:3

# If Python 3 + git is sufficient, then use:
# FROM cicirello/pyaction:3

# To pull from the GitHub Container Registry instead, use one of these:
# FROM ghcr.io/cicirello/pyaction-lite:3
# FROM ghcr.io/cicirello/pyaction:4
# FROM ghcr.io/cicirello/pyaction:3


RUN apt-get update && apt-get install -y \
gource


COPY entrypoint.py /entrypoint.py
ENTRYPOINT ["/entrypoint.py"]
Loading

0 comments on commit 0fb5448

Please sign in to comment.