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

test: Properly test the find_unreleased_changelog_items action #73

Merged
merged 2 commits into from
Sep 6, 2024
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
37 changes: 29 additions & 8 deletions .github/workflows/test-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,46 @@ jobs:
run: |
FILE_PATH="./temp_job_summary.md"

# Define the multiline string using a heredoc
MULTILINE_STRING=$(cat <<'EOF'
# Define the start and end parts of the multiline string using heredocs
START_STRING=$(cat <<'EOF'
## Workflow Inputs
- release-level: patch
## PRs Merged Since Last Release

EOF
)
END_STRING=$(cat <<'EOF'
## Incoming Changes
Things to be included in the next release go here.
### Added
- Something will be added
EOF
)

# Compare the file contents to the multiline string
if diff <(echo "$MULTILINE_STRING") "$FILE_PATH" > /dev/null; then
# Read file contents
FILE_CONTENTS=$(cat "$FILE_PATH")

# Extract the start and end parts of the file contents
FILE_START=$(echo "$FILE_CONTENTS" | head -n "$(echo "$START_STRING" | wc -l)")
FILE_END=$(echo "$FILE_CONTENTS" | tail -n "$(echo "$END_STRING" | wc -l)")

# Compare the start and end parts
if [ "$FILE_START" == "$START_STRING" ] && [ "$FILE_END" == "$END_STRING" ]; then
echo "The Job Summary contents are correct."
else
echo "The Job Summary contents are not correct. Here is the diff:"
diff <(echo "$MULTILINE_STRING") "$FILE_PATH"
echo "The Job Summary contents are not correct."
echo ""
echo "Expected start:"
echo "$START_STRING"
echo ""
echo "Actual start:"
echo "$FILE_START"
echo ""
echo ""
echo "Expected end:"
echo "$END_STRING"
echo ""
echo "Actual end:"
echo "$FILE_END"
exit 1
fi
test-update_development_dependencies:
Expand All @@ -127,7 +148,7 @@ jobs:
update-pre-commit: true
run-pre-commit: true
dependency-dict: '{"dev": ["pyright"]}'
pre-commit-hook-skip-list: remove-tabs,forbid-tabs,check-readthedocs,check-dependabot,check-github-actions,check-github-workflows,commitizen,blacken-docs,yamlfix,hadolint,mdformat,markdown-link-check,check-poetry,toml-sort-fix,pyright,poetry-audit,ruff,ruff-format,docformatter,renovate-config-validator
pre-commit-hook-skip-list: remove-tabs,forbid-tabs,check-readthedocs,check-dependabot,check-github-actions,check-github-workflows,commitizen,blacken-docs,yamlfix,hadolint,mdformat,markdown-link-check,check-poetry,toml-sort-fix,pyright,poetry-audit,ruff,ruff-format,docformatter,renovate-config-validator,actionlint
export-dependency-groups: |
actions-update_development_dependencies:actions/update_development_dependencies,
tests
Expand Down
Loading