From effa6aa3bd2ef54a0c4d4ff636744ae79df7a3a0 Mon Sep 17 00:00:00 2001 From: Foxushka <135865149+Foxushka@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:25:10 +0000 Subject: [PATCH] Use helper account for translations updates (#310) --- .github/workflows/update-translations.yml | 6 ++++-- chameleonultragui/lib/helpers/github.dart | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.yml index 26d9d3ab..ad47e974 100644 --- a/.github/workflows/update-translations.yml +++ b/.github/workflows/update-translations.yml @@ -53,8 +53,10 @@ jobs: if: steps.git-check.outputs.has_changes == 'true' uses: peter-evans/create-pull-request@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.BOT_HELPER_TOKEN }} base: main branch: translations-branch - commit-message: "New translations fetched from Crowdin" + push-to-fork: ChameleonHelper/ChameleonUltraGUI + body: "Update translations" title: "feat: Update translations" + delete-branch: true diff --git a/chameleonultragui/lib/helpers/github.dart b/chameleonultragui/lib/helpers/github.dart index 148c97d4..dd782f64 100644 --- a/chameleonultragui/lib/helpers/github.dart +++ b/chameleonultragui/lib/helpers/github.dart @@ -42,6 +42,8 @@ List> developers = [ }, ]; +List excludedAccounts = ["github-actions[bot]", "ChameleonHelper"]; + Future>> fetchGitHubContributors() async { try { final response = json.decode((await http.get(Uri.parse( @@ -52,7 +54,7 @@ Future>> fetchGitHubContributors() async { if (response is List) { List> contributors = []; for (var contributor in response) { - if (contributor['login'] != 'github-actions[bot]' && + if (!excludedAccounts.contains(contributor['login']) && !developers.any( (developer) => developer['username'] == contributor['login'])) { contributors.add({