triggerWorkflow function

Future<void> triggerWorkflow({
  1. required String authToken,
  2. required String repoName,
  3. required String ref,
  4. required String dependencyName,
  5. required Version dependencyVersion,
})

Implementation

Future<void> triggerWorkflow({
  required String authToken,
  required String repoName,
  required String ref,
  required String dependencyName,
  required Version dependencyVersion,
}) async {
  var res = await post(
      Uri.parse(
          "https://api.github.com/repos/hydro-sdk/$repoName/actions/workflows/waveform-upgrade.yml/dispatches"),
      headers: {
        "Authorization": "token $authToken",
        "Accept": "application/vnd.github.v3+json",
      },
      body:
          '{"ref":"$ref", "inputs": {"depName": "$dependencyName","depVersion":"$dependencyVersion" }}');

  print(res.statusCode);
  print(res.body);
}