Skip to content

Commit

Permalink
exit 0 on no URL found
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Sep 10, 2024
1 parent a742945 commit dadb0c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Verify linked version matches core version
id: version-check
run: ./script/ci/version_check.sh ${{ github.event.pull_request.body }}
run: ./script/ci/version_check.sh "${{ github.event.pull_request.body }}"

- name: Add comment if versions differ
if: steps.version-check.outputs.version_mismatch == 'true'
Expand Down
10 changes: 5 additions & 5 deletions script/ci/version_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ set -e

# script/ci/version_check

PR_BODY="$1"
PR_BODY="$@"

# Extract URL from PR description
WP_URL=$(echo "${PR_BODY}" | grep -oE 'https://community.openproject.org/(wp|work_packages|projects/[^/]+/work_packages)/[0-9]+')
WP_URL=$(echo "$PR_BODY" | grep -oE 'https://community.openproject.org/(wp|work_packages|projects/[^/]+/work_packages)/[0-9]+' || true)

if [ -z "$WP_URL" ]; then
echo "::warning::PR description does not contain a valid URL to an OpenProject ticket."
Expand Down Expand Up @@ -74,9 +74,9 @@ if [[ "$VERSION_FROM_API" != "$VERSION_FROM_FILE" ]]; then
echo "Version mismatch detected."

echo "version_mismatch=true" >> "$GITHUB_OUTPUT"
echo "wp_url='${WP_URL}'" >> "$GITHUB_OUTPUT"
echo "wp_version='${VERSION_FROM_API}'" >> "$GITHUB_OUTPUT"
echo "core_version='${VERSION_FROM_FILE}'" >> "$GITHUB_OUTPUT"
echo "wp_url=${WP_URL}" >> "$GITHUB_OUTPUT"
echo "wp_version=${VERSION_FROM_API}" >> "$GITHUB_OUTPUT"
echo "core_version=${VERSION_FROM_FILE}" >> "$GITHUB_OUTPUT"
else
echo "Version from the work package ${WORK_PACKAGE_ID} matches the version in the version file this PR targets."
fi

0 comments on commit dadb0c9

Please sign in to comment.