Skip to content

Commit

Permalink
Merge pull request #7 from valicm/6-add-validation-for-output-file-th…
Browse files Browse the repository at this point in the history
…at-is-of-md-extension

Validate md extension. Fix broken release link
  • Loading branch information
valicm committed Nov 1, 2023
2 parents 84b3996 + a5c7881 commit 0e6fe35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ jobs:
| Run any update, except for Drupal core | `bash drupal-update.sh -t all -c false` |
| Run minor update, excluding some modules | `bash drupal-update.sh -e pathauto,redirect` |
| Run all updates, saving summary in upgrade.md | `bash drupal-update.sh -t all -o upgrade.md` |


Get all minor updates and output results in summary.md file.
```bash
curl -fsSL https://raw.githubusercontent.com/valicm/drupal-update/main/drupal-update.sh | bash -s -- -o summary.md
```
7 changes: 6 additions & 1 deletion drupal-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ validate_options() {
echo "Error: Core flag must be either true or false. Default if empty is false"
exit_error
fi

if [ -n "$SUMMARY_FILE" ] && [[ "$SUMMARY_FILE" != *.md ]]; then
echo "Error: Summary output file needs to end with .md extension"
exit_error
fi
}

# Validate if all requirements are present.
Expand Down Expand Up @@ -156,7 +161,7 @@ UPDATES=$(composer outdated "drupal/*" -f json -D --locked --ignore-platform-req
for UPDATE in $(echo "${UPDATES}" | jq -c '.locked[]'); do
PROJECT_NAME=$(echo "${UPDATE}" | jq '."name"' | sed "s/\"//g")
PROJECT_URL=$(echo "${UPDATE}" | jq '."homepage"' | sed "s/\"//g")
if [ -n "$PROJECT_URL" ]; then
if [ -z "$PROJECT_URL" ] || [ "$PROJECT_URL" == null ]; then
PROJECT_URL="https://www.drupal.org/project/drupal"
fi
CURRENT_VERSION=$(echo "${UPDATE}" | jq '."version"' | sed "s/\"//g")
Expand Down

0 comments on commit 0e6fe35

Please sign in to comment.