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

Documentation added about automated report generation #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 0 additions & 21 deletions .editorconfig

This file was deleted.

11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@ gitleaves genreports
ls reports/
```

- Automate report generation
<TODO> Document github actions based report generation
- Automate report generation
If the leaves git repo is hosted on Github, the actions in the `sample-workflow` directory can help you publish it to the repo’s wiki
1. Ensure that a [wiki is enabled for your repo](https://docs.github.com/en/communities/documenting-your-project-with-wikis/)
2. We will also need
1. a Github [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
2. which needs to be added as a [secret to your repo](https://docs.github.com/en/actions/security-guides/encrypted-secrets)
1. the key name should be `GH_PERSONAL_ACCESS_TOKEN` (since that is what we call it in our actions.) and its value should be the token you created.
3. Copy the two `.yml` files in the `sample-workflows` directory in this repo to the `.github/workflows/` directory of your repo.
4. And then, whenever there’s a push to the `data` directory in the main branch, the actions will generate a reports wiki in the Github Wiki section.

## Process

Expand Down
20 changes: 20 additions & 0 deletions sample-workflows/push_to_wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Push report to wiki
on:
workflow_run:
workflows: [ "process with gitleaves" ]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Upload report to Wiki
uses: SwiftDocOrg/github-wiki-publish-action@v1
with:
path: "reports/ghwiki"
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
43 changes: 43 additions & 0 deletions sample-workflows/run_gitleaves.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: process with gitleaves

# Controls when the workflow will run
on:
schedule:
- cron: 0 0-23/4 * * *

# Triggers the workflow on a push to the data directory
push:
branches: [ main ]
paths:
- 'data/*'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Pip install requirements.txt
- uses: py-actions/py-dependency-install@v2

# Runs a set of commands using the runners shell

- name: Generate reports with Gitleaves
run: |
echo Add other actions to build, test, and deploy your project.
gitleaves genreports

- name: Figure out if anythings changed since the last run, this step helps with the cron job.
id: changes
run: echo ::set-output name=has_stuff_changed::$(git status --porcelain)

- name: Commit if there are changes, otherwise this step is skipped.
if: ${{ steps.changes.outputs.has_stuff_changed != '' }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add reports
git commit -m "Leave report published to wiki." && git push