-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from T0biii/add-bump-modules
[CI] add Github action to bump modules commit Version
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
name: "Update Modules base" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write # so it can comment | ||
pull-requests: write # so it can create pull requests | ||
|
||
jobs: | ||
update-Modules: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Clone Firmware | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get update branch name | ||
id: branch-name | ||
run: echo "branch-name=update-modules-${{ github.event.inputs.branch }}-$(date +%s)" >> $GITHUB_OUTPUT | ||
|
||
- name: Invoke update-modules | ||
run: ./contrib/actions/update-modules.sh | ||
|
||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
title: '[Update] ${{ github.event.inputs.branch }} modules' | ||
body: | | ||
Update modules for ${{ github.event.inputs.branch }} branche | ||
- Auto-generated by [create-pull-request][1] | ||
[1]: https://github.com/peter-evans/create-pull-request | ||
commit-message: bump modules version | ||
branch: ${{ steps.branch-name.outputs.branch-name }} | ||
|
||
- name: Check outputs | ||
if: ${{ steps.cpr.outputs.pull-request-number }} | ||
run: | | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | ||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Die Datei, die die Repository-Informationen enthaelt | ||
MODULES_FILE="modules" | ||
|
||
# Durchlaufe die Datei, um alle Repository-URLs und ihre entsprechenden Commit-Variablen zu finden | ||
# shellcheck disable=SC2094 | ||
while IFS= read -r line; do | ||
# Überprüfe, ob die Zeile eine Repository-URL ist | ||
if [[ "$line" == "PACKAGES_"*"_REPO="* ]]; then | ||
# Extrahiere den Repository-Namen und die URL | ||
REPO_NAME=$(echo "$line" | cut -d '=' -f 1) | ||
REPO_URL=$(echo "$line" | cut -d '=' -f 2-) | ||
|
||
# Den neuesten Commit für das Repository abrufen | ||
NEW_COMMIT=$(git ls-remote "$REPO_URL" | grep -oE '[0-9a-f]{40}' | head -n1) | ||
|
||
# Überprüfen, ob ein neuer Commit gefunden wurde | ||
if [ -n "$NEW_COMMIT" ]; then | ||
# Den Wert des Commits in der Datei aktualisieren | ||
# shellcheck disable=SC2094 | ||
COMMIT_LINE=$(grep -n "${REPO_NAME/_REPO/_COMMIT}" "$MODULES_FILE" | cut -d ':' -f 1) | ||
# shellcheck disable=SC2094 | ||
sed -i "${COMMIT_LINE}s/.*/${REPO_NAME/_REPO/_COMMIT}=$NEW_COMMIT/" "$MODULES_FILE" | ||
echo "Der Wert von ${REPO_NAME/_REPO/_COMMIT} wurde auf den neuesten Commit ($NEW_COMMIT) aktualisiert." | ||
else | ||
echo "Fehler: Der neueste Commit f r $REPO_NAME konnte nicht abgerufen werden." | ||
fi | ||
fi | ||
done < "$MODULES_FILE" |