Skip to content

Fix release notes diff in github release actions#1882

Open
atandon2024 wants to merge 8 commits into
mongodb:mainfrom
atandon2024:fix-github-release-notes
Open

Fix release notes diff in github release actions#1882
atandon2024 wants to merge 8 commits into
mongodb:mainfrom
atandon2024:fix-github-release-notes

Conversation

@atandon2024
Copy link
Copy Markdown

@atandon2024 atandon2024 commented Feb 6, 2026

Fix GitHub Actions release notes generation - Corrects an issue where draft release notes included commits from earlier releases due to an incorrect comparison range. Additional changes were necessary due to feedback from the semgrep-code bot, specifically moving variables to env vars.

Tested: https://github.com/atandon2024/mongo-java-driver/releases/tag/untagged-d68ec2c3f4e63cb2b5e0

@atandon2024 atandon2024 requested a review from a team as a code owner February 6, 2026 19:40
@atandon2024 atandon2024 requested a review from vbabanin February 6, 2026 19:40
Copy link
Copy Markdown
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

One question about fetch depth.

with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
fetch-depth: 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does this do?

I think fetch-depth: 0 fetches all history for all branches and tags. But is it just for the mongodb-labs/drivers-github-tools/secure-checkout or is it for the java driver repo itself?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@rozza yes fetch-depth 0 fetches all branches and tags.

Per the GitHub Actions documentation (https://docs.github.com/en/actions/tutorials/create-an-example-workflow), drivers-github-tools is only pulled internally to run the action itself. The checkout operates on github.ref.

rozza
rozza previously approved these changes Feb 10, 2026
Copy link
Copy Markdown
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have we tested this in the fork yet? I also noticed the note: "Needs to be tested by triggering GitHub Actions manually before merging.”

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Comment thread .github/workflows/release.yml Outdated
@semgrep-code-mongodb
Copy link
Copy Markdown

Semgrep found 1 run-shell-injection finding:

Using variable interpolation ${{...}} with github context data in a run: step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. github context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with env: to store the data and use the environment variable in the run: script. Be sure to use double-quotes the environment variable, like this: "$ENVVAR".

🛟 Help? Slack #semgrep-help or go/semgrep-help.

Resolution Options:

  • Fix the code
  • Reply /fp $reason (if security gap doesn’t exist)
  • Reply /ar $reason (if gap is valid but intentional; add mitigations/monitoring)
  • Reply /other $reason (e.g., test-only)

Comment thread .github/workflows/release.yml
@atandon2024 atandon2024 reopened this May 18, 2026
@atandon2024 atandon2024 force-pushed the fix-github-release-notes branch from 95ee4ef to cd8c537 Compare May 18, 2026 20:45
Comment thread .github/workflows/release.yml Outdated
Comment on lines 46 to 54
run: |
echo CURRENT_TAG=$(git \
-c versionsort.suffix=-alpha \
-c versionsort.suffix=-beta \
-c versionsort.suffix=-rc \
tag --list 'r*' --sort=-v:refname | head -n 1) >> $GITHUB_ENV
echo RELEASE_VERSION=${{ inputs.version }} >> $GITHUB_ENV
echo RELEASE_VERSION_WITHOUT_SUFFIX=$(echo ${{ inputs.version }} | awk -F- '{print $1}') >> $GITHUB_ENV
if [[ "${{ inputs.version }}" =~ (alpha|beta|rc)[0-9]+$ ]]; then
Copy link
Copy Markdown

@semgrep-code-mongodb semgrep-code-mongodb Bot May 18, 2026

Choose a reason for hiding this comment

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

Using variable interpolation ${{...}} with github context data in a run: step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. github context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with env: to store the data and use the environment variable in the run: script. Be sure to use double-quotes the environment variable, like this: "$ENVVAR".

🌟 Fixed in commit 61f89a9 🌟

@atandon2024 atandon2024 force-pushed the fix-github-release-notes branch from cc90723 to cd8c537 Compare May 18, 2026 20:48
if [[ "${{ inputs.version }}" =~ (alpha|beta|rc)[0-9]+$ ]]; then
echo NEXT_VERSION=$(echo ${{ inputs.version }} | awk -F- '{print $1}') >> $GITHUB_ENV
echo RELEASE_BRANCH=${{ github.ref_name }} >> $GITHUB_ENV
echo CURRENT_TAG=$(git \
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this git command is somewhat complex. what it does - a) get all tags b) teaches git that those suffixes make a version lower than just the minor/major version c) get the first one in the list (which is the most current tag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants