Skip to content

Add workflow to initiate package release #525

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

Merged
merged 2 commits into from
Jun 11, 2025
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/initiate-package-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://github.com/changesets/action
name: Initiate-Release

on:
workflow_dispatch:

jobs:
initiate-release:
name: Initiate-Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Check if main branch is used
run: |
BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}')
if [[ "$BRANCH_NAME" != "main" ]]; then
echo "Branch $BRANCH_NAME is not allowed to use this action"
exit 1
fi
Comment on lines +16 to +22
Copy link
Member

Choose a reason for hiding this comment

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

We're already specifying the head branch as main in the command below, why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Workflow can be run on any branch. Running on any other branch won't affect the flow but it is misleading to leave it as is


- name: Checkout repository
uses: actions/checkout@v4

- name: Check changeset files
id: check_files
run: |
if find ./.changeset -maxdepth 1 -type f -name "*.md" ! -name "README.md" | grep -q .; then
echo "files_exists=true" >> $GITHUB_OUTPUT
else
echo "files_exists=false" >> $GITHUB_OUTPUT
fi
Comment on lines +27 to +34
Copy link
Member

Choose a reason for hiding this comment

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

There's already another workflow for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This check is basically to avoid PR creation if there is no changeset files present at the moment

Copy link
Member

Choose a reason for hiding this comment

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

I suppose they're not exactly the same


- name: Create release PR
if: ${{ steps.check_files.outputs.files_exists == 'true' }}
run: gh pr create -B production -H main --title 'Initiate release' --body 'Merges main into production' --reviewer bbenligiray
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}