From 2ab37dcb8ce568801161cb8c4a009a08e6f66576 Mon Sep 17 00:00:00 2001 From: "Miguel A. Cabrera Minagorri" Date: Mon, 11 Apr 2022 18:08:23 +0200 Subject: [PATCH] Add ability to provide shift parameter to the action Signed-off-by: Miguel A. Cabrera Minagorri --- .github/workflows/sync.yaml | 13 +++++++------ scripts/fetch-commits.sh | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 0bfa204266ab..495e95e477e2 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -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 }} diff --git a/scripts/fetch-commits.sh b/scripts/fetch-commits.sh index bc1ec957e85e..473580e12f21 100755 --- a/scripts/fetch-commits.sh +++ b/scripts/fetch-commits.sh @@ -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=""