-
Notifications
You must be signed in to change notification settings - Fork 17
Add auto-release-check workflow #546
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,118 @@ | ||||||||||||
| # This workflow periodically checks if there are unreleased changes and automatically triggers a release | ||||||||||||
|
|
||||||||||||
| name: Auto Release Check | ||||||||||||
|
|
||||||||||||
| on: | ||||||||||||
| workflow_call: | ||||||||||||
| inputs: | ||||||||||||
| cron-schedule: | ||||||||||||
| description: Cron schedule for periodic checks (default is daily at 2 AM UTC) | ||||||||||||
| required: false | ||||||||||||
| type: string | ||||||||||||
| default: '0 2 * * *' | ||||||||||||
| dry-run: | ||||||||||||
| description: Dry run mode for testing | ||||||||||||
| required: false | ||||||||||||
| type: boolean | ||||||||||||
| default: false | ||||||||||||
| tag: | ||||||||||||
| description: The tag to use during publish, values are latest, next | ||||||||||||
| required: false | ||||||||||||
| type: string | ||||||||||||
| default: latest | ||||||||||||
| schedule: | ||||||||||||
| # Default: Run daily at 2 AM UTC | ||||||||||||
| - cron: '0 2 * * *' | ||||||||||||
| workflow_dispatch: | ||||||||||||
| inputs: | ||||||||||||
| dry-run: | ||||||||||||
| description: Dry run mode for testing | ||||||||||||
| required: false | ||||||||||||
| type: boolean | ||||||||||||
| default: false | ||||||||||||
| tag: | ||||||||||||
| description: The tag to use during publish, values are latest, next | ||||||||||||
| required: false | ||||||||||||
| type: string | ||||||||||||
| default: latest | ||||||||||||
|
|
||||||||||||
| permissions: | ||||||||||||
| contents: write | ||||||||||||
| id-token: write | ||||||||||||
|
Comment on lines
+39
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security: Workflow-level The Consider scoping permissions per-job: give
Suggested change
Double-check suggestion before committing. Edit this comment for amendments. Please provide feedback on the review comment by checking the appropriate box:
|
||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| check-unreleased-changes: | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
| outputs: | ||||||||||||
| has-unreleased-changes: ${{ steps.check-changes.outputs.has-unreleased-changes }} | ||||||||||||
| latest-tag: ${{ steps.check-changes.outputs.latest-tag }} | ||||||||||||
| commits-count: ${{ steps.check-changes.outputs.commits-count }} | ||||||||||||
| steps: | ||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||
| with: | ||||||||||||
| fetch-depth: 0 # Fetch all history for tags and commits | ||||||||||||
|
|
||||||||||||
| - name: Check for unreleased changes | ||||||||||||
| id: check-changes | ||||||||||||
| run: | | ||||||||||||
| # Get the latest release tag (assuming format vX.Y.Z) | ||||||||||||
| latest_tag=$(git tag -l 'v*' --sort=-version:refname | head -n 1) | ||||||||||||
|
|
||||||||||||
| if [ -z "$latest_tag" ]; then | ||||||||||||
| echo "No release tags found, assuming first release needed" | ||||||||||||
| echo "has-unreleased-changes=true" >> $GITHUB_OUTPUT | ||||||||||||
| echo "latest-tag=none" >> $GITHUB_OUTPUT | ||||||||||||
| echo "commits-count=all" >> $GITHUB_OUTPUT | ||||||||||||
| exit 0 | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| echo "Latest release tag: $latest_tag" | ||||||||||||
| echo "latest-tag=$latest_tag" >> $GITHUB_OUTPUT | ||||||||||||
|
|
||||||||||||
| # Count commits since the latest tag | ||||||||||||
| commits_count=$(git rev-list ${latest_tag}..HEAD --count) | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Unquoted variable If Same issue also applies to line 84 (
Suggested change
Double-check suggestion before committing. Edit this comment for amendments. Please provide feedback on the review comment by checking the appropriate box:
|
||||||||||||
| echo "commits-count=$commits_count" >> $GITHUB_OUTPUT | ||||||||||||
|
|
||||||||||||
| echo "Commits since $latest_tag: $commits_count" | ||||||||||||
|
|
||||||||||||
| if [ "$commits_count" -gt 0 ]; then | ||||||||||||
| echo "Found $commits_count unreleased commit(s)" | ||||||||||||
| echo "has-unreleased-changes=true" >> $GITHUB_OUTPUT | ||||||||||||
|
|
||||||||||||
| # Show the commits for logging | ||||||||||||
| echo "Unreleased commits:" | ||||||||||||
| git log ${latest_tag}..HEAD --oneline | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Unquoted variable The variable should be double-quoted, consistent with the fix suggested for line 73.
Suggested change
Double-check suggestion before committing. Edit this comment for amendments. Please provide feedback on the review comment by checking the appropriate box:
|
||||||||||||
| else | ||||||||||||
| echo "No unreleased changes found" | ||||||||||||
| echo "has-unreleased-changes=false" >> $GITHUB_OUTPUT | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| trigger-release: | ||||||||||||
| needs: check-unreleased-changes | ||||||||||||
| if: ${{ needs.check-unreleased-changes.outputs.has-unreleased-changes == 'true' }} | ||||||||||||
| uses: ./.github/workflows/release.yml | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic Error:
The referenced workflow must expose a Please provide feedback on the review comment by checking the appropriate box:
|
||||||||||||
| with: | ||||||||||||
| dry-run: ${{ inputs.dry-run || false }} | ||||||||||||
| tag: ${{ inputs.tag || 'latest' }} | ||||||||||||
| secrets: inherit | ||||||||||||
|
|
||||||||||||
| summary: | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
| needs: [check-unreleased-changes, trigger-release] | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic Error:
To always run the summary regardless of whether
Suggested change
Double-check suggestion before committing. Edit this comment for amendments. Please provide feedback on the review comment by checking the appropriate box:
|
||||||||||||
| if: always() | ||||||||||||
| steps: | ||||||||||||
| - name: Generate summary | ||||||||||||
| run: | | ||||||||||||
| echo "# Auto Release Check Summary" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| echo "**Latest Tag:** ${{ needs.check-unreleased-changes.outputs.latest-tag }}" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| echo "**Unreleased Commits:** ${{ needs.check-unreleased-changes.outputs.commits-count }}" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| echo "**Has Unreleased Changes:** ${{ needs.check-unreleased-changes.outputs.has-unreleased-changes }}" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||
|
|
||||||||||||
| if [ "${{ needs.check-unreleased-changes.outputs.has-unreleased-changes }}" == "true" ]; then | ||||||||||||
| echo "β **Action:** Release workflow triggered" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| echo "**Release Status:** ${{ needs.trigger-release.result }}" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| else | ||||||||||||
| echo "βΉοΈ **Action:** No release needed" >> $GITHUB_STEP_SUMMARY | ||||||||||||
| fi | ||||||||||||
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.
Bug:
workflow_calltrigger'scron-scheduleinput is defined but never usedThe
cron-scheduleinput is declared underworkflow_callinputs (line 8β12) but is never referenced anywhere in the workflow. The hardcodedscheduletrigger (line 23β25) always runs at0 2 * * *and ignores this input entirely. GitHub Actions does not support dynamically changing theschedulecron from aworkflow_callinput β schedules are static and cannot be parameterised at call time.The
cron-scheduleinput should be removed to avoid misleading callers who might believe they can override the schedule through it.Double-check suggestion before committing. Edit this comment for amendments.
Please provide feedback on the review comment by checking the appropriate box: