Skip to content
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
40 changes: 40 additions & 0 deletions .github/workflows/org-coding-hours.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Organization Coding Hours

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'

jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set
run: echo "matrix=$(jq -c '.repos' repos.json)" >> $GITHUB_OUTPUT

calculate:
needs: set-matrix
runs-on: ubuntu-latest
strategy:
matrix:
repo: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Checkout target repository
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
path: repo
- name: Run git-hours
uses: .github/actions/git-hours
with:
window_start: ''
working-directory: repo
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.repo }}-git-hours
path: repo/git-hours.json
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Coding Hours

This repository contains a reusable GitHub composite action for running the
[git-hours](https://github.com/kimmobrunfeldt/git-hours) tool.
This repository contains a reusable GitHub composite action for running the [git-hours](https://github.com/kimmobrunfeldt/git-hours) tool.

## Composite Action

Expand Down Expand Up @@ -41,5 +40,8 @@ jobs:
path: ${{ steps.hours.outputs.results }}
```

Run the workflow manually and the resulting `git-hours.json` file will be
available as an artifact.
Run the workflow manually and the resulting `git-hours.json` file will be available as an artifact.

## Organization Reports and GitHub Pages

A separate workflow, `.github/workflows/org-coding-hours.yml`, reads a list of repositories from `repos.json` and generates coding hours reports for each one. The reports can be published or downloaded as artifacts. The repository also serves a GitHub Pages site under the `docs` folder that lists the repositories being tracked.
37 changes: 37 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coding Hours Repositories</title>
<style>
body { font-family: Arial, sans-serif; margin: 2em; }
h1 { color: #333; }
ul { list-style-type: none; padding: 0; }
li { margin: 0.5em 0; }
</style>
</head>
<body>
<h1>Repositories Tracked for Coding Hours</h1>
<ul id="repo-list"></ul>
<script>
fetch('../repos.json')
.then(response => response.json())
.then(data => {
const list = document.getElementById('repo-list');
data.repos.forEach(repo => {
const li = document.createElement('li');
const link = document.createElement('a');
link.href = 'https://github.com/' + repo;
link.textContent = repo;
li.appendChild(link);
list.appendChild(li);
});
})
.catch(err => {
document.getElementById('repo-list').textContent = 'Failed to load repo list.';
console.error(err);
});
</script>
</body>
</html>
7 changes: 7 additions & 0 deletions repos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"repos": [
"ni/labview-icon-editor",
"ni/actor-framework",
"ni/open-source"
]
}