Skip to content

Conversation

Arlodotexe
Copy link
Member

Problem

Automated weekly releases created by scheduled-releases.yml were not triggering the build workflow, resulting in missing release artifacts and malformed version numbers.

Root Cause: GitHub Actions tokens cannot trigger workflows on tag creation events. When the scheduled workflow creates tags via git tag and git push, the resulting tag event is ignored by other workflows due to GitHub's security model.

Reference: https://github.com/orgs/community/discussions/76402

"If an action uses a token to do something to the repo, it won't trigger other actions"

Solution

Replace git tag + git push with gh release create, which triggers release events that CAN be activated by Actions tokens.

Key Insight: gh release create automatically creates the associated tag if it doesn't exist, so we don't need separate tag creation commands.

Changes

.github/workflows/scheduled-releases.yml

  • Removed: Git configuration (no longer needed with gh CLI)
  • Changed: Tag creation approach from git tag -a + git push to gh release create
  • Added: Release title and auto-generated release notes
  • Added: --prerelease flag to mark weekly releases appropriately

Before:

- name: Create and push tag
  run: |
    TAG="release/weekly/$(date +%y%m%d)"
    git config user.name "github-actions[bot]"
    git config user.email "github-actions[bot]@users.noreply.github.com"
    git tag -a "$TAG" -m "Release $TAG"
    git push origin "$TAG"

After:

- name: Create weekly release
  env:
    GH_TOKEN: ${{ github.token }}
  run: |
    TAG="release/weekly/$(date +%y%m%d)"
    gh release create "$TAG" \
      --title "Weekly Release $(date +%y%m%d)" \
      --generate-notes \
      --prerelease

.github/workflows/build.yml

  • Added: release: types: [published] trigger to catch automated releases
  • Added: Filter step to restrict builds to weekly releases only (blocks manual releases with non-matching patterns)

New trigger:

on:
  push:
    branches: [ main ]
    tags: [ 'release/weekly/**' ]  # Keep for backward compatibility
  pull_request:
    types: [opened, reopened, synchronize]
  release:                          # NEW
    types: [published]

New filter step:

- name: Check if weekly release
  if: github.event_name == 'release'
  shell: pwsh
  run: |
    $tagName = "${{ github.event.release.tag_name }}"
    Write-Host "Release event triggered with tag: $tagName"
    
    if ($tagName -match "^release/weekly/") {
      Write-Host "✓ Matched weekly release tag: $tagName"
      exit 0
    } else {
      Write-Host "✗ Tag does not match weekly pattern: $tagName - skipping build"
      exit 1
    }

Testing

  • Automated test: Next scheduled run on Wednesday will validate the fix
  • Manual test: Can trigger scheduled-releases.yml manually via Actions UI
  • Expected behavior:
    • Release created with auto-generated tag
    • Build workflow triggers from release event
    • Version formatting works correctly
    • Release artifacts published successfully

Backward Compatibility

The existing tags: [ 'release/weekly/**' ] trigger remains in place for backward compatibility with any manual tag pushes, though the primary trigger path is now the release event.

References

GitHub Actions tokens cannot trigger workflows on tag creation (security feature).
This change replaces git tag + push with gh release create, which triggers release
events that CAN activate workflows.

Changes:
- scheduled-releases.yml: Use gh release create instead of git tag + push
- build.yml: Add release: types: [published] trigger with weekly-only filter

The filter ensures only automated weekly releases trigger builds, blocking manual
releases until needed

Ref: https://github.com/orgs/community/discussions/76402
@Arlodotexe
Copy link
Member Author

Arlodotexe commented Oct 2, 2025

Missing fixes for malformed package names and missing Ribbon control, coming soon™️.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Let's try this out then

@Arlodotexe Arlodotexe merged commit a4def9a into main Oct 6, 2025
24 checks passed
@Arlodotexe Arlodotexe deleted the ci/fix-weekly-release-trigger branch October 6, 2025 17:51
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.

2 participants