Add ability to provide shift parameter to the action

Signed-off-by: Miguel A. Cabrera Minagorri <mcabrera@vmware.com>
This commit is contained in:
Miguel A. Cabrera Minagorri
2022-04-11 18:16:11 +02:00
parent 5e7bf23e24
commit 2ab37dcb8c
2 changed files with 8 additions and 7 deletions
+7 -6
View File
@@ -1,13 +1,14 @@
name: Sync containers repositories
on:
# schedule:
# # Every day at 1 AM
# - cron: '0 1 * * *'
schedule:
# Every day at 1 AM
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
tags:
description: 'Test manually'
shift:
description: 'Commits to shift if you edited the containers folder'
default: '0'
jobs:
build:
name: Trigger Site Rebuild
@@ -18,4 +19,4 @@ jobs:
with:
token: ${{ secrets.BITNAMI_BOT_SECRET }}
- name: Fetch
run: ./scripts/fetch-commits.sh
run: ./scripts/fetch-commits.sh ${{ github.event.inputs.shift }}
+1 -1
View File
@@ -58,7 +58,7 @@ function findCommitsToSync() {
# Find the commit that doesn't have changes respect the container folder
# Get the last commit message in the container folder
local shift=$((COMMIT_SHIFT + 1))
local -r last_commit_message="$(git log -n "$shift" --pretty=tformat:"%s" containers/"$origin_name" | tail -n 1)"
local -r last_commit_message="$(git log -n "$shift" --pretty=tformat:"%s" ./containers/"$origin_name" | tail -n 1)"
# Search on the container origin repo the ID for the latest commit we have locally in the container folder
local -r last_synced_commit_id="$(git rev-list "$origin_name"/master --grep="${last_commit_message}")"
local commits_to_sync=""