Skip to content

Commit

Permalink
run changelog gen and lint even if not Merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed May 24, 2024
1 parent c8330ec commit 91bc3f9
Showing 1 changed file with 25 additions and 35 deletions.
60 changes: 25 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,23 @@ jobs:
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
command: |
mkdir ~/changelog_build
git status
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
github_changelog_generator \
--exclude-tags-regex "^(?!v).*?$" \
--user bids-standard \
--project bids-specification \
--token ${CHANGE_TOKEN} \
--output ~/changelog_build/CHANGES.md \
--base ~/project/src/pregh-changes.md \
--header-label "# Changelog" \
--release-branch master \
--no-issues \
--no-filter-by-milestone \
--no-compare-link \
--pr-label "" \
--enhancement-label "" \
--bugs-label "" \
--exclude-labels "exclude-from-changelog"
cat ~/changelog_build/CHANGES.md
else
echo "Commit or Release, do nothing"
fi
github_changelog_generator \
--exclude-tags-regex "^(?!v).*?$" \
--user bids-standard \
--project bids-specification \
--token ${CHANGE_TOKEN} \
--output ~/changelog_build/CHANGES.md \
--base ~/project/src/pregh-changes.md \
--header-label "# Changelog" \
--release-branch master \
--no-issues \
--no-filter-by-milestone \
--no-compare-link \
--pr-label "" \
--enhancement-label "" \
--bugs-label "" \
--exclude-labels "exclude-from-changelog"
cat ~/changelog_build/CHANGES.md
- persist_to_workspace:
# raw generated changelog in ~/changelog_build/CHANGES.md
root: ~/.
Expand All @@ -151,24 +146,19 @@ jobs:
name: remark on autogenerated CHANGES.md
# format changelog, then use sed to change * to -, then lint changelog
command: |
git status
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
head -n 100 ~/changelog_build/CHANGES.md
npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md
head -n 100 ~/changelog_build/CHANGES.md
sed -i 's/* /- /' ~/changelog_build/CHANGES.md
head -n 100 ~/changelog_build/CHANGES.md
npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc
else
echo "Commit or Release, do nothing"
fi
head -n 100 ~/changelog_build/CHANGES.md
npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md
head -n 100 ~/changelog_build/CHANGES.md
sed -i 's/* /- /' ~/changelog_build/CHANGES.md
head -n 100 ~/changelog_build/CHANGES.md
npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc
- persist_to_workspace:
# linted and fixed changelog in ~/changelog_build/CHANGES.md
root: ~/.
paths:
- changelog_build

# Push built changelog to repo
# Push built changelog to repo (only if if last commit was a "Merge commit" on master)
commit_generated_changelog:
docker:
- image: cimg/base:stable
Expand All @@ -194,7 +184,7 @@ jobs:
git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}"
git push https://${CHANGE_TOKEN}@github.com/bids-standard/bids-specification.git master
else
echo "Commit or Release, do nothing"
echo "Did not detect a "Merge commit" to master, or detected a Release ... doing nothing."
fi
workflows:
Expand Down

0 comments on commit 91bc3f9

Please sign in to comment.