-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto update check for templates and trigger workflow from package…
… release Signed-off-by: Dennis Meister <[email protected]>
- Loading branch information
1 parent
35b40c5
commit 3fb94e6
Showing
2 changed files
with
78 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,25 @@ | ||
name: Trigger Velocitas Update Workflow | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
CHECK_UPDATES_FILE: check-updates.yml | ||
|
||
jobs: | ||
trigger: | ||
strategy: | ||
matrix: | ||
# repo: ["vehicle-app-python-template", "vehicle-app-cpp-template", "vehicle-app-cpp-sdk"] | ||
# Start with python template | ||
repo: ["vehicle-app-python-template"] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Trigger Workflow | ||
run: | | ||
echo "${{ secrets.VELOCITAS_PROJECT_TOKEN }}" | gh auth login --with-token | ||
gh workflow run $CHECK_UPDATES_FILE -R eclipse-velocitas/${{ matrix.repo }} |
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,53 @@ | ||
name: Package Updates | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 4 * * *" | ||
|
||
jobs: | ||
package_update_check: | ||
if: github.repository_owner == 'eclipse-velocitas' | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.VELOCITAS_PROJECT_TOKEN }} | ||
|
||
- name: Use devcontainer for upgrade and PR creation | ||
uses: devcontainers/[email protected] | ||
with: | ||
runCmd: | | ||
sudo apt-get update && sudo apt-get install -y gh | ||
echo "${{ secrets.VELOCITAS_PROJECT_TOKEN }}" | gh auth login --with-token | ||
velocitas upgrade --ignore-bounds && velocitas init && velocitas sync | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git add . | ||
git commit -m "Update velocitas package versions" | ||
BRANCH_NAME="automated-update-${{ github.sha }}" | ||
git push origin HEAD:$BRANCH_NAME | ||
PR_TITLE="Automated Package Update" | ||
PR_BODY="This pull request was created automatically by GitHub Actions to update package versions." | ||
# Check if a PR with the same title already exists | ||
PR_EXISTING=$(gh pr list --state open --search "$PR_TITLE" --json number | jq -r '.[0].number // empty') | ||
if [ -n "$PR_EXISTING" ]; then | ||
echo "Existing PR found (#${PR_EXISTING}). Closing..." | ||
gh pr close "$PR_EXISTING" -d | ||
fi | ||
echo "Creating new PR..." | ||
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --head $BRANCH_NAME --base main | ||
else | ||
echo "No changes detected. Skip creating Pull Request." | ||
fi |