-
Notifications
You must be signed in to change notification settings - Fork 5
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
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,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 | ||
|
||
- 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
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. There's already another workflow for this 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. This check is basically to avoid PR creation if there is no changeset files present at the moment 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. 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 }} |
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.
We're already specifying the head branch as
main
in the command below, why is this needed?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.
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