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

fix: fix minor bugs in update script #171

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
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: 9 additions & 4 deletions update_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ function ensure_and_set_parameters_or_exit() {

while [[ $# -gt 0 ]]; do
case $1 in
--dry-run)
dry_run="true"
shift
;;
-f|--force)
force_execution="true"
repository_path=$2
Expand Down Expand Up @@ -187,10 +191,10 @@ cd "$repository_path" || exit 8

echo "Fetching the latest version of the workflows"

latest_template_path=$(mktemp -d -t repository-template-XXXXX)
latest_template_path=$(mktemp -d -t repository-templates-XXXXX)
gh repo clone https://github.com/Hapag-Lloyd/Workflow-Templates.git "$latest_template_path" -- -b main -q

if [ "$force_execution" != "false" ]; then
if [ "$force_execution" != "true" ]; then
restart_script_if_newer_version_available "$repository_path" "$latest_template_path"
fi

Expand All @@ -211,12 +215,13 @@ cp "$latest_template_path/.github/pull_request_template.md" .github/
cp "$latest_template_path/.github/renovate.json5" .github/
cp "$latest_template_path/update_workflows.sh" .github/

git ls-files --modified -z .github/workflows/scripts/ .github/update_workflows.sh | xargs -0 git update-index --chmod=+x
git ls-files -z -o --exclude-standard | xargs -0 git update-index --add --chmod=+x
git ls-files --modified -z .github/workflows/scripts/ .github/update_workflows.sh | xargs -0 -I {} git update-index --chmod=+x {}
git ls-files -z -o --exclude-standard | xargs -0 -I {} git update-index --add --chmod=+x {}

mkdir -p .config
# copy fails if a directory is hit. dictionaries/ is handled in the setup_cspell function
cp -p "$latest_template_path/.config/"*.* .config/
cp -p "$latest_template_path/.config/".*.* .config/

setup_cspell "$latest_template_path"

Expand Down
Loading