Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fix: Timetracking script is now working (#162)
Browse files Browse the repository at this point in the history
* fix: invalid permission for get_data.sh

Signed-off-by: Henry Brink <henry@henrybrink.de>

* change the other path

Signed-off-by: Henry Brink <henry@henrybrink.de>

* fix: Python modules missing

Signed-off-by: Henry Brink <henry@henrybrink.de>

* fix: Environment

Signed-off-by: Henry Brink <henry@henrybrink.de>

* debug

Signed-off-by: Henry Brink <henry@henrybrink.de>

* fix env

Signed-off-by: Henry Brink <henry@henrybrink.de>

* fix: Issue

Signed-off-by: Henry Brink <henry@henrybrink.de>

* change: checkout before commit

Signed-off-by: Henry Brink <henry@henrybrink.de>

* I have no fun anymore

Signed-off-by: Henry Brink <henry@henrybrink.de>

* I don't know about that

Signed-off-by: Henry Brink <henry@henrybrink.de>

* Further nonsense

Signed-off-by: Henry Brink <henry@henrybrink.de>

* Yes.

Signed-off-by: Henry Brink <henry@henrybrink.de>

* Body missing for PR

Signed-off-by: Henry Brink <henry@henrybrink.de>

* add push to the action

Signed-off-by: Henry Brink <henry@henrybrink.de>

* Open the PR for the correct branch

Signed-off-by: Henry Brink <henry@henrybrink.de>

---------

Signed-off-by: Henry Brink <henry@henrybrink.de>
  • Loading branch information
henrybrink authored May 9, 2024
1 parent a6b089e commit 367b7dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/timetracking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,40 @@ jobs:
permissions:
pull-requests: write
contents: write
environment: timetracking-prod
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout new branch
run: |
git checkout -b actions/timetracking-${{ github.run_id }}
git push --set-upstream origin actions/timetracking-${{ github.run_id }}
- name: Fetch the current timetracking data
run: cd docs/project/timetracking && ./get_data.sh
env:
KIMAI_API_TOKEN: ${{ secrets.KIMAI_API_TOKEN }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pandas numpy matplotlib
- name: Generate the desired charts
run: cd docs/guidelines/timetracking && python generate_charts.py
run: cd docs/project/timetracking && python generate_charts.py
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
- uses: peterjgrainger/action-create-branch@v2.2.0
name: 'Create a new branch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'actions/new-timetracking-data'
sha: 'main'
- name: Push changes
run: git push
- name: 'Checkout the new branch'
uses: actions/checkout@v4
with:
ref: 'actions/new-timetracking-data'
- name: 'Create a new Pull Request'
run: gh pr create -a benedictweis -B main --title \"Update timetracking data\""
run: gh pr create -a benedictweis -B main -H "actions/timetracking-${{ github.run_id }}" --title "Update timetracking data" --body "Automated PR"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
1 change: 1 addition & 0 deletions docs/project/timetracking/get_data.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ TIME_RESPONSE=$(curl -s -X "GET" \
-H "accept: application/json" \
-H "Authorization: Bearer $KIMAI_API_TOKEN")

echo $TIME_RESPONSE

for WEEK in $WEEKS; do
TIMES=$(jq --arg WEEK "$WEEK" '[.[] | select(.begin | strptime("%Y-%m-%dT%H:%M:%S%z") | strftime("%W") as $w|$w==$WEEK)]' <<< "$TIME_RESPONSE")
Expand Down

0 comments on commit 367b7dd

Please sign in to comment.