Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ on:
branches:
- main
- alpha
workflow_dispatch:
Copy link
Collaborator Author

@hariram-ni hariram-ni Sep 25, 2025

Choose a reason for hiding this comment

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

workflow_dispatch section enables manual triggering of GitHub Actions workflow

inputs:
prerelease:
description: 'Create a pre-release version'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'

jobs:
release:
Expand All @@ -27,6 +37,20 @@ jobs:
- name: Unit tests
run: npm run test:ci

- run: npm run release
- name: Check manual release conditions
if: github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'false' && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/alpha'
run: |
echo "::error::Cannot run standard release from non-main/non-alpha branch. Use prerelease=true instead."
exit 1

- name: Pre-release
if: github.event.inputs.prerelease == 'true'
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

- name: Automatic release
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha')
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The condition logic may not handle all workflow_dispatch scenarios correctly. When workflow_dispatch is triggered without specifying the prerelease input (or when it's set to 'false'), and the workflow is run from the main branch, none of the release steps will execute because:

  1. Line 40's condition prevents standard releases from non-main branches
  2. Line 46's condition only runs when prerelease is 'true'
  3. Line 52's condition only runs on push events to main

If a user manually triggers the workflow from the main branch with prerelease='false', no release will occur. Consider adding a condition to handle this case:

- name: Manual standard release
  if: github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'false' && github.ref == 'refs/heads/main'
  run: npm run release
  env:
    GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
Suggested change
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
- name: Manual standard release
if: github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'false' && github.ref == 'refs/heads/main'
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

Copilot uses AI. Check for mistakes.
5 changes: 5 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const package = 'systemlink-grafana-plugins';

module.exports = {
branches: [
'main',
'alpha',
{ name: '*', prerelease: 'pre' }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this will make sure, any other branch other than main and alpha will create pre release version like 4.11.0-pre.1

Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The wildcard branch pattern { name: '*', prerelease: 'pre' } will match all branches, including 'main'. This means semantic-release will attempt to create pre-releases even from the main branch, which conflicts with the intent of having main produce standard releases.

Consider using a more specific pattern that excludes main:

branches: [
    'main',
    { name: '+([0-9])?(.{+([0-9]),x}).x', prerelease: 'pre' },
    { name: 'feature/*', prerelease: 'pre' },
    { name: 'fix/*', prerelease: 'pre' }
]

Or use a negative pattern to exclude main:

branches: [
    'main',
    { name: '!(main)', prerelease: 'pre' }
]
Suggested change
{ name: '*', prerelease: 'pre' }
{ name: '!(main)', prerelease: 'pre' }

Copilot uses AI. Check for mistakes.
],
plugins: [
["@semantic-release/commit-analyzer", {
preset: "conventionalcommits"
Expand Down