Skip to content

Commit

Permalink
test: Properly test the find_unreleased_changelog_items action (#73)
Browse files Browse the repository at this point in the history
* test: Properly test the find_unreleased_changelog_items action

* ci: Skip one more pre-commit hook when running the action test since it isn't necessary to validate the action
  • Loading branch information
nfelt14 authored Sep 6, 2024
1 parent b977a87 commit 56c083f
Showing 1 changed file with 29 additions and 8 deletions.
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

0 comments on commit 56c083f

Please sign in to comment.