LoginSignup
0

More than 1 year has passed since last update.

[Flutter/Dart] Dependabot がサポートしてくれるまでの繋ぎの GitHub Actions

Last updated at Posted at 2021-10-26

https://github.com/dependabot/dependabot-core/issues/2166 が resolve されるまで、GitHub Actions で dependencies の定期更新をしたい時の話。

Flutter

https://github.com/sensuikan1973/pedax/blob/main/.github/workflows/flutter_deps.yaml から抜粋。

# TODO: If https://github.com/dependabot/dependabot-core/issues/2166 is resolved, this workflow becomes unnecessary.
name: Upgrade Flutter Dependencies

on:
  schedule:
    - cron: '0 1 * * 5' # every Friday, 01:00 (UTC)
  workflow_dispatch:

jobs:
  upgrade_flutter_dependencies:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v1

      - run: flutter doctor -v
      - run: flutter pub upgrade --null-safety # See: https://dart.dev/tools/pub/cmd/pub-upgrade#--null-safety

      # See: https://github.com/peter-evans/create-pull-request/tree/master#reference-example
      - name: create PR
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.PAT }} # See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs
          commit-message: '[Scheduled] `flutter pub upgrade --null-safety`'
          title: '[Scheduled] `flutter pub upgrade --null-safety`'
          body: |
            Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
            ---
            See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs
          delete-branch: true
          labels: dependencies

Dart

https://github.com/sensuikan1973/dart-boilerplate/blob/main/.github/workflows/dart_deps.yaml から抜粋。

# TODO: If https://github.com/dependabot/dependabot-core/issues/2166 is resolved, this workflow becomes unnecessary.
name: Upgrade Dart Dependencies

on:
  schedule:
    - cron: '0 1 * * 5' # every Friday, 01:00 (UTC)
  workflow_dispatch:

jobs:
  upgrade_dart_dependencies:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v2
      - uses: dart-lang/setup-dart@v1

      - run: dart pub upgrade --null-safety # See: https://dart.dev/tools/pub/cmd/pub-upgrade#--null-safety

      # See: https://github.com/peter-evans/create-pull-request/tree/master#reference-example
      - name: create PR
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.PAT }} # See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs
          commit-message: '[Scheduled] `dart pub upgrade --null-safety`'
          title: '[Scheduled] `dart pub upgrade --null-safety`'
          body: |
            Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
            ---
            See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs
          delete-branch: true
          labels: dependencies

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0