Add a github workflow for reverting PRs.#184593
Conversation
This is a simple github workflow to replace the revert service in cocoon. It is set to use a tag called `revert_wf` for now, so that it doesn't conflict with the existing service. Once we have tested this workflow and are happy with it, we can turn down the cocoon service and change this workflow to respond to the `revert` label instead.
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
| REASON=$(gh pr view ${{ github.event.pull_request.number }} --json comments \ | ||
| --jq '.comments[] | .body | select(startswith("Reason for revert:")) | sub("^Reason for revert:\\s*"; "")' | head -n 1) | ||
|
|
||
| if [ -z "$REASON" ]; then |
There was a problem hiding this comment.
Is there a code injection vulnerability here if the $REASON from someones pr tries to escape its way out of the shell?
There was a problem hiding this comment.
I believe expanding an environment variable inside double quotes is safe. Contents of the variable are automatically escaped properly. For example, you can't end the quote early, because if the comment contains a quote, bash replaces it with an escaped quote \".
| REVIEWER=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \ | ||
| --jq '[.[] | select(.state == "APPROVED")] | .[0].user.login') | ||
|
|
||
| echo "MERGE_COMMIT=$MERGE_COMMIT" >> $GITHUB_ENV |
There was a problem hiding this comment.
can you add a comment about what these lines of of code doing?
There was a problem hiding this comment.
This is just taking the information we've gathered and attaching it to the github environment so it can be accessed in subsequent steps. This happens all over the place in these workflows (you can see many examples of this in the other steps in this workflow and in the other workflows I linked).
|
|
||
| - name: Checkout Fork | ||
| if: steps.find-reason.outputs.found == 'true' | ||
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
There was a problem hiding this comment.
Can you add a comment about when this has needs to be updated.
There was a problem hiding this comment.
I'm not sure we have an official process for updating these pinned tags.
| if: steps.find-reason.outputs.found == 'true' | ||
| working-directory: ./flutter | ||
| run: | | ||
| git config user.name "flutteractionsbot" |
There was a problem hiding this comment.
Is this the same way we set author info in other workflow? if so can you add a link as a reply to this comment?
There was a problem hiding this comment.
Yes, see the other workflows I linked.
| env: | ||
| GITHUB_TOKEN: ${{ secrets.FLUTTERACTIONSBOT_CP_TOKEN }} | ||
| run: | | ||
| git push origin ${{ env.BRANCH_NAME }} |
There was a problem hiding this comment.
What is the difference between upstream and origin in this workflow?
There was a problem hiding this comment.
Origin is flutteractionsbot's fork of the flutter repo. Upstream is flutter/flutter. Branch creation is restricted on flutter/flutter, so the PR branch needs to be created in a separate fork. This is the same pattern used in the other workflows I mentioned.
flutter/flutter@a0924c7...05e0ae0 2026-04-08 meylis@divine.video Fix Android engine flags defaulting to true for malformed values (flutter/flutter#184631) 2026-04-08 katelovett@google.com Try one more again (flutter/flutter#184767) 2026-04-08 goderbauer@google.com Remove custom `analysis_options.yaml` from `imitation_game_flutter` (flutter/flutter#184717) 2026-04-08 victorsanniay@gmail.com Add more error handling to unawaited callsites (flutter/flutter#184526) 2026-04-08 34465683+rkishan516@users.noreply.github.com Refactor: remove material from absorb_ponter_test, container_test, lookup_boundary_test, page_view_test, router_test, semantics_clipping_test, semantics_merge_test, shadow_test, text_test (flutter/flutter#183309) 2026-04-08 73785960+xfce0@users.noreply.github.com Remove editable_text_utils cross-imports from material and cupertino … (flutter/flutter#184519) 2026-04-08 robert.ancell@canonical.com Replace hard coded max path length with system defined one. (flutter/flutter#184697) 2026-04-08 jesswon@google.com [Re-land] Add Support For Built-in Kotlin (flutter/flutter#184745) 2026-04-08 15619084+vashworth@users.noreply.github.com Manually stop and continue LLDB breakpoints on Xcode 26.4+ (flutter/flutter#184690) 2026-04-08 katelovett@google.com Code freeze workflow (flutter/flutter#184246) 2026-04-08 737941+loic-sharma@users.noreply.github.com [Dot shorthands] Migrate examples/api/lib/widgets (flutter/flutter#183965) 2026-04-08 59215665+davidhicks980@users.noreply.github.com [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#182036) 2026-04-08 87018443+mayanksharma9@users.noreply.github.com [Semantics] clarify Android header docs (flutter/flutter#183573) 2026-04-08 dacoharkes@google.com [ci] mac build_test bringup false (flutter/flutter#184738) 2026-04-08 34871572+gmackall@users.noreply.github.com Reland "Apply rect clipping to surface views" (flutter/flutter#184732) 2026-04-08 bkonyi@google.com Remove bringup label for resharded Windows tool_integration_tests shards (flutter/flutter#184721) 2026-04-08 namangoyaldev@gmail.com Tool: Add search and filtering to widget preview scaffold (flutter/flutter#184023) 2026-04-08 36861262+QuncCccccc@users.noreply.github.com Update localization from translation console (flutter/flutter#184742) 2026-04-07 rmolivares@renzo-olivares.dev Revert "Add Support For Built-in Kotlin (#184227)" (flutter/flutter#184739) 2026-04-07 34871572+gmackall@users.noreply.github.com Collect HCPP adoption analytics for flutter run/build apk/build appbundle (flutter/flutter#184225) 2026-04-07 jacksongardner@google.com Add a github workflow for reverting PRs. (flutter/flutter#184593) 2026-04-07 jesswon@google.com Add Support For Built-in Kotlin (flutter/flutter#184227) 2026-04-07 34871572+gmackall@users.noreply.github.com Revert "Apply rect clipping to surface views (#184471)" (flutter/flutter#184728) 2026-04-07 jesswon@google.com [Fix-forward] Added Compose plugin to Add-to-app Integration Test (flutter/flutter#184681) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is a simple github workflow to replace the revert service in cocoon. It is set to use a tag called `revert_wf` for now, so that it doesn't conflict with the existing service. Once we have tested this workflow and are happy with it, we can turn down the cocoon service and change this workflow to respond to the `revert` label instead.
…r#11470) flutter/flutter@a0924c7...05e0ae0 2026-04-08 meylis@divine.video Fix Android engine flags defaulting to true for malformed values (flutter/flutter#184631) 2026-04-08 katelovett@google.com Try one more again (flutter/flutter#184767) 2026-04-08 goderbauer@google.com Remove custom `analysis_options.yaml` from `imitation_game_flutter` (flutter/flutter#184717) 2026-04-08 victorsanniay@gmail.com Add more error handling to unawaited callsites (flutter/flutter#184526) 2026-04-08 34465683+rkishan516@users.noreply.github.com Refactor: remove material from absorb_ponter_test, container_test, lookup_boundary_test, page_view_test, router_test, semantics_clipping_test, semantics_merge_test, shadow_test, text_test (flutter/flutter#183309) 2026-04-08 73785960+xfce0@users.noreply.github.com Remove editable_text_utils cross-imports from material and cupertino … (flutter/flutter#184519) 2026-04-08 robert.ancell@canonical.com Replace hard coded max path length with system defined one. (flutter/flutter#184697) 2026-04-08 jesswon@google.com [Re-land] Add Support For Built-in Kotlin (flutter/flutter#184745) 2026-04-08 15619084+vashworth@users.noreply.github.com Manually stop and continue LLDB breakpoints on Xcode 26.4+ (flutter/flutter#184690) 2026-04-08 katelovett@google.com Code freeze workflow (flutter/flutter#184246) 2026-04-08 737941+loic-sharma@users.noreply.github.com [Dot shorthands] Migrate examples/api/lib/widgets (flutter/flutter#183965) 2026-04-08 59215665+davidhicks980@users.noreply.github.com [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#182036) 2026-04-08 87018443+mayanksharma9@users.noreply.github.com [Semantics] clarify Android header docs (flutter/flutter#183573) 2026-04-08 dacoharkes@google.com [ci] mac build_test bringup false (flutter/flutter#184738) 2026-04-08 34871572+gmackall@users.noreply.github.com Reland "Apply rect clipping to surface views" (flutter/flutter#184732) 2026-04-08 bkonyi@google.com Remove bringup label for resharded Windows tool_integration_tests shards (flutter/flutter#184721) 2026-04-08 namangoyaldev@gmail.com Tool: Add search and filtering to widget preview scaffold (flutter/flutter#184023) 2026-04-08 36861262+QuncCccccc@users.noreply.github.com Update localization from translation console (flutter/flutter#184742) 2026-04-07 rmolivares@renzo-olivares.dev Revert "Add Support For Built-in Kotlin (#184227)" (flutter/flutter#184739) 2026-04-07 34871572+gmackall@users.noreply.github.com Collect HCPP adoption analytics for flutter run/build apk/build appbundle (flutter/flutter#184225) 2026-04-07 jacksongardner@google.com Add a github workflow for reverting PRs. (flutter/flutter#184593) 2026-04-07 jesswon@google.com Add Support For Built-in Kotlin (flutter/flutter#184227) 2026-04-07 34871572+gmackall@users.noreply.github.com Revert "Apply rect clipping to surface views (#184471)" (flutter/flutter#184728) 2026-04-07 jesswon@google.com [Fix-forward] Added Compose plugin to Add-to-app Integration Test (flutter/flutter#184681) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is a simple github workflow to replace the revert service in cocoon. It is set to use a tag called
revert_wffor now, so that it doesn't conflict with the existing service. Once we have tested this workflow and are happy with it, we can turn down the cocoon service and change this workflow to respond to therevertlabel instead.