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

Fix generation of BIDS changelog #1835

Closed
wants to merge 11 commits into from
63 changes: 26 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,37 +98,31 @@ jobs:
docker:
- image: ferrarimarco/github-changelog-generator:1.14.3
steps:
- setup_remote_docker:
version: 18.06.0-ce
- setup_remote_docker
# checkout code to default ~/project
- checkout
- run:
name: Build changelog
# $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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could start running the changelog generation and linting on every commit to master ... and then commit this as previously, only on "Merge commits" to master.

This would allow us to earlier find issues with generation and linting.

- persist_to_workspace:
# raw generated changelog in ~/changelog_build/CHANGES.md
root: ~/.
Expand All @@ -152,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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 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 @@ -195,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