Skip to content
Open
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
40 changes: 40 additions & 0 deletions .github/workflows/batch_release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Creates Batch Release for A Package"

on:
repository_dispatch:
types: [batch_release_pr]

jobs:
create_release_pr:
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.event.client_payload.package }}-${{ github.run_id }}-${{ github.run_attempt }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

So the cron job is constantly creating new branches? What cleans up branches that don't actually end up published?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that can be a problem. then I think the right thing to do will be re-use the same branch name and do a clean up before creating a new release

Copy link
Contributor Author

Choose a reason for hiding this comment

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

steps:
- name: checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Set up tools
run: dart pub get
working-directory: ${{ github.workspace }}/script/tool
- name: create batch release PR
run: |
git config --global user.name ${{ secrets.USER_NAME }}
git config --global user.email ${{ secrets.USER_EMAIL }}
dart ./script/tool/lib/src/main.dart branch-for-batch-release --packages=${{ github.event.client_payload.package }} --branch=${{ env.BRANCH_NAME }} --remote=origin
- name: Check if branch was created
id: check-branch-exists
uses: GuillaumeFalourd/branch-exists@v1.1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am new to GA, not sure if we are allowed to use GA from marketplace, let me know if this is not allowed.

Also is there a way to test this locally?

with:
branch: ${{ env.BRANCH_NAME }}

- name: Create Pull Request
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't the entire task going to fail as an error if there were no changes (meaning the branch was not created in the previous step)? No-ops should not look like failure when we look at run logs, or it's going to be very hard to notice actual failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added condition

if: steps.check-branch-exists.outputs.exists == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[${{ github.event.client_payload.package }}] Batch release"
title: "[${{ github.event.client_payload.package }}] Batch release"
body: "This PR was created automatically to batch release the `${{ github.event.client_payload.package }}`."
branch: ${{ env.BRANCH_NAME }}
base: release


17 changes: 17 additions & 0 deletions .github/workflows/go_router_batch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Creates Batch Release for go_router"

on:
schedule:
# Run every Monday at 8:00 AM
- cron: "0 8 * * 1"

jobs:
dispatch_release_pr:
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v4
with:
token: "${{ secrets.GITHUB_TOKEN }}"
event-type: batch_release_pr
client-payload: '{"package": "go_router"}'
6 changes: 6 additions & 0 deletions packages/go_router/pending_changelogs/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use this file as template to draft a unreleased changelog file.
# Make a copy of this file in the same directory, rename it, and fill in the details.
changelog: |
- Can include a list of changes.
- with markdown supported.
version: <major|minor|patch|skip>
6 changes: 6 additions & 0 deletions packages/go_router/pending_changelogs/test_only_1.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

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

If these files are going to be created as part of the PR process, then the tooling should be updated to understand that, and the override labels shouldn't be needed on this PR. If the PR isn't landable without overrides, then the normal commit path isn't working correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, that part of the work will be in flutter/flutter#176433.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually if a change to repo structure requires updates to our checks we do those two things in the same PR rather than override our own tooling, so it's not clear to me why this is being done separately. That said, since it's isolated to this package and shouldn't affect any normal PRs for now I guess it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I don't do the ci check before this pr is that I would like to finalize the yaml content first, and it can't be finalized until the approach of this PR is reviewed and approved.

and I think doing it as part of this pr may be too distracting for reviewer

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is for test purposes only.
# TODO(chuntai): remove this file before publishing.
changelog: |
- Adds 'batch' option to CI config for go_router package.
- Updates GitHub Actions workflow for batch releases of go_router.
version: major
5 changes: 5 additions & 0 deletions packages/go_router/pending_changelogs/test_only_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is for test purposes only.
# TODO(chuntai): remove this file before publishing.
changelog: |
- Adds some other features
version: minor
Loading