-
Notifications
You must be signed in to change notification settings - Fork 41
Add NEWS.md and news reminder workflow #25
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
Open
RensDofferhoff
wants to merge
11
commits into
jasp-stats:master
Choose a base branch
from
RensDofferhoff:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
498a6af
Create NEWS.md
RensDofferhoff 523f577
Update NEWS.md
RensDofferhoff ca45a1c
Create remind-news.yml
RensDofferhoff a3cf94d
Update DESCRIPTION
RensDofferhoff af22ef4
Create auto-bump-version.yml (#2)
RensDofferhoff 38cf2c4
chore: auto-bump version to 0.1.2 [skip ci]
github-actions[bot] 598aa21
Update auto-bump-version.yml
RensDofferhoff a793b58
chore: auto-bump version to 0.1.3 [skip ci]
github-actions[bot] bc53cf4
Update DESCRIPTION
RensDofferhoff b64d410
Update NEWS.md
RensDofferhoff bb78800
chore: auto-bump version to 0.1.1 [skip ci]
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Auto-bump Version on Merge | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| bump-version: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Calculate and Update Version | ||
| id: calc | ||
| run: | | ||
| # Default to not skipping | ||
| echo "SKIP_BUMP=false" >> "$GITHUB_ENV" | ||
|
|
||
| # 1. Extract version from current commit | ||
| RAW_VERSION=$(grep -i "^Version:" DESCRIPTION | awk '{print $2}' | tr -d '\r') | ||
|
|
||
| # 2. STRICT FORMAT CHECK: Must be exactly x.y.z (numbers only) | ||
| if [[ ! "$RAW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "❌ ERROR: Version '$RAW_VERSION' is not in strictly x.y.z format." | ||
| echo "Failing workflow to prevent malformed versioning." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 3. Get version from previous commit safely | ||
| OLD_ON_BRANCH=$(git show HEAD^:DESCRIPTION 2>/dev/null | grep -i "^Version:" | awk '{print $2}' | tr -d '\r' || true) | ||
|
|
||
| # 4. Do nothing if manual change is detected | ||
| if [ "$RAW_VERSION" != "$OLD_ON_BRANCH" ] && [ -n "$OLD_ON_BRANCH" ]; then | ||
| echo "Manual version bump detected ($OLD_ON_BRANCH -> $RAW_VERSION). Doing nothing." | ||
| echo "SKIP_BUMP=true" >> "$GITHUB_ENV" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # 5. z+1 | ||
| IFS='.' read -r -a PARTS <<< "$RAW_VERSION" | ||
| X=${PARTS[0]} | ||
| Y=${PARTS[1]} | ||
| Z=${PARTS[2]} | ||
|
|
||
| Z=$((Z + 1)) | ||
| NEW_VERSION="$X.$Y.$Z" | ||
|
|
||
| echo "Bumping version from $RAW_VERSION to $NEW_VERSION" | ||
|
|
||
| # 6. Write to file (safely overwrites whatever comes after "Version: ") | ||
| sed -i "s/^Version:.*/Version: $NEW_VERSION/i" DESCRIPTION | ||
|
|
||
| # Export for next step | ||
| echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Commit and Push | ||
| if: env.SKIP_BUMP == 'false' | ||
| run: | | ||
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git config --local user.name "github-actions[bot]" | ||
|
|
||
| git add DESCRIPTION | ||
|
|
||
| if ! git diff-index --quiet HEAD; then | ||
| git commit -m "chore: auto-bump version to ${{ env.NEW_VERSION }} [skip ci]" | ||
| git push | ||
| echo "✅ Successfully bumped version to ${{ env.NEW_VERSION }}." | ||
| else | ||
| echo "No changes needed." | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Remind NEWS.md Update | ||
|
|
||
| # We only run this when the PR is first opened so the bot doesn't | ||
| # spam the contributor with comments on every single new commit. | ||
| on: | ||
| pull_request: | ||
| types: [opened] | ||
|
|
||
| jobs: | ||
| remind-news: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write # Required so the bot can leave a comment | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check if NEWS.md was modified | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| # Get the list of changed files | ||
| CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }} HEAD) | ||
|
|
||
| # Check if NEWS.md is in that list | ||
| if echo "$CHANGED_FILES" | grep -q "^NEWS\.md$"; then | ||
| echo "✅ NEWS.md was updated. No reminder needed." | ||
| exit 0 | ||
| else | ||
| echo "⚠️ NEWS.md not updated. Posting a friendly reminder..." | ||
|
|
||
| # Use the GitHub CLI to post a comment directly to the PR | ||
| gh pr comment ${{ github.event.pull_request.number }} --body "👋 **Friendly reminder:** It looks like \`NEWS.md\` wasn't updated in this Pull Request. | ||
|
|
||
| If your changes include bug fixes, new features, or UI tweaks, please consider adding a quick note to the \`# jaspYourModule (development version)\` section so our users know about your awesome work! *(If this is just a minor typo fix, feel free to ignore this message.)*" | ||
|
|
||
| # We exit with 0 (success) so the check turns green and does NOT block the PR | ||
| exit 0 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # jaspModuleTemplate Changelog | ||
|
|
||
| > **HOW TO READ AND UPDATE THIS CHANGELOG:** | ||
| > | ||
| > This document follows a modified [Keep a Changelog](https://keepachangelog.com/) format adapted for the R/JASP ecosystem. Releases are listed in reverse chronological order (newest first). | ||
| > As an example see [jaspModuleTemplate](https://github.com/RensDofferhoff/jaspModuleTemplate/blob/master/NEWS.md) | ||
| > * **Adding New Changes (For Contributors):** All new commits should be logged at the very top of the file under the `# jaspModuleTemplate (development version)` header. Place your bullet point under the appropriate category (`## Added`, `## Fixed`, etc.). | ||
RensDofferhoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > * **Issue References:** Please reference the relevant GitHub Issue (if any) at the end of your line (e.g., `([Issue #19](https://github.com/jasp-stats/jaspModuleTemplate/issues/19)`). | ||
| > * **Format Categories:** > * **Added:** New template features, QML examples, or build tools. | ||
| > * **Changed:** Updates to default configurations, boilerplate code, or dependencies. | ||
| > * **Fixed:** Bug fixes in the build pipeline, R wrappers, or QML layouts. | ||
| > * **Deprecated / Removed:** Outdated template components or legacy code. | ||
|
|
||
| --- | ||
|
|
||
| # jaspModuleTemplate (development version) | ||
|
|
||
| ## Added | ||
| * Added NEWS.md | ||
| * Added workflow to remind users to update their `NEWS.md`. | ||
| * Added workflow to auto-bump version when user does not do so. | ||
|
|
||
| --- | ||
|
|
||
| # jaspModuleTemplate 0.1.0 | ||
|
|
||
| ## Added | ||
| * Initial examples to showcase JASP module development | ||
|
|
||
| ## Changed | ||
| * Use best practices for checking input ([Issue #19](https://github.com/jasp-stats/jaspModuleTemplate/issues/19)). | ||
| * The main results table now defaults to displaying 95% Confidence Intervals for effect sizes. | ||
|
|
||
| ## Fixed | ||
| * Remove deprecated dependencies from qml files ([Issue #14](https://github.com/jasp-stats/jaspModuleTemplate/issues/14)). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a better approach than actions/github-script?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. Any suggestions? I dont want to enforce it to fiercely so thought a little reminder message was fine