Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 11 additions & 11 deletions .github/workflows/publish-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: Publish (reusable workflow)
on:
workflow_call:
inputs:
version:
description: 'Version number or tag for the release. For example: v1.0.1'
required: true
type: string
release_notes:
description: 'Release notes'
required: true
Expand All @@ -16,7 +12,11 @@ on:
required: true
type: string
environment_name:
description: 'Name of environment that specifies PyPI/TestPyPI url'
description: 'Name for PyPI/TestPyPI environment'
type: string
required: true
environment_url:
description: 'URL for PyPI/TestPyPI environment'
type: string
required: true
secrets:
Expand All @@ -31,10 +31,13 @@ jobs:
publish:
name: Build
runs-on: ubuntu-latest
environment: ${{ inputs.environment_name }}
environment:
name: ${{ inputs.environment_name }}
url: ${{ inputs.environment_url }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_REFNAME: ${{ github.ref_name }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -73,11 +76,8 @@ jobs:

- name: Create GitHub Release
env:
VERSION: ${{ inputs.version }}
NOTES: ${{ inputs.release_notes }}
run: gh release create $VERSION --repo $GITHUB_REPO --notes $NOTES
run: gh release create $GITHUB_REFNAME --repo $GITHUB_REPO --notes $NOTES
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The gh release create command will fail if a release with the same tag already exists. When triggering on push events, GITHUB_REFNAME will be a branch name (e.g., main), not a version tag, which will cause conflicts. Consider adding a --clobber flag or checking if the release exists first, or ensure this only runs on tag pushes.

See below for a potential fix:

      if: startsWith(github.ref, 'refs/tags/')
      env:
        NOTES: ${{ inputs.release_notes }}
      run: gh release create $GITHUB_REFNAME --repo $GITHUB_REPO --notes "$NOTES" --clobber

Copilot uses AI. Check for mistakes.

- name: Upload GitHub Release
env:
VERSION: ${{ inputs.version }}
run: gh release upload $VERSION dist/** --repo $GITHUB_REPO
run: gh release upload $GITHUB_REFNAME dist/** --repo $GITHUB_REPO
17 changes: 4 additions & 13 deletions .github/workflows/publish-to-testpypi.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
name: Publish to TestPyPI

on:
workflow_dispatch:
inputs:
version:
description: 'Version name for release'
required: true
on: push
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

Publishing to TestPyPI on every push to any branch will create numerous releases and may quickly exhaust rate limits. Consider restricting this to specific branches (e.g., main or develop) or adding path filters to prevent unintended publishing.

Suggested change
on: push
on:
push:
branches:
- main
- develop

Copilot uses AI. Check for mistakes.

jobs:
publish:
name: Publish wheel to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/seclab-taskflow-agent2
permissions:
contents: write
id-token: write # For trusted publishing
uses: .github/workflows/publish-reusable.yml@main
uses: ./.github/workflows/publish-reusable.yml
with:
version: ${{ inputs.version }}
release_notes: ${{ github.head_ref }}
repository_url: https://test.pypi.org/legacy/
environment: testpypi
environment_name: testpypi
environment_url: https://test.pypi.org/p/seclab-taskflow-agent2
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}