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

feat: create automated pull requests for new Kimai Versions #287

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Save version number"
run: echo "${{steps.remote_version.outputs.version}}"
- uses: actions/checkout@v3

- name: "Update kimai version in _config.yml"
run: scripts/update-version-number.sh "${{ github.event.client_payload.kimai_version }}"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "docs: update kimai_2_version to ${{ github.event.client_payload.kimai_version }}"
title: "docs: update kimai_2_version to ${{ github.event.client_payload.kimai_version }}"
branch: "docs/update-kimai-to-${{ github.event.client_payload.kimai_version }}"
kevinpapst marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions scripts/update-version-number.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

set -e

CONFIG_FILE="_config.yml"

if [ $# -ne 1 ]; then
echo "Usage: $0 <new_value>"
exit 1
fi

new_value="$1"

# Use awk to update the kimai_v2_version value in the CONFIG_FILE
awk -v new_version="$new_value" '/kimai_v2_version:/ {$2 = "\"" new_version "\""} 1' "$CONFIG_FILE" > temp.yml && mv temp.yml "$CONFIG_FILE"

echo "Updated $CONFIG_FILE: Set kimai_v2_version to '$new_value'"