guibranco / gstraccini-bot

🤖 :octocat: GStraccini-bot automates repository management, ensuring organization and health by handling pull requests, issues, comments, and commits.
https://bot.straccini.com
MIT License
2 stars 0 forks source link

[FEATURE] Retrieve and parse repository configuration from `TOML` file #443

Open guibranco opened 3 weeks ago

guibranco commented 3 weeks ago

Description

When performing any action on the repository, retrieve the configuration file and parse it to handle repository configuration.

The file is in [TOML]() format and should be in one of these paths:

Tech notes

To parse the TOML file follow this tutorial:

https://laravel-news.com/toml-configuration-in-php

And use this library:

https://github.com/yosymfony/toml

private function loadConfig()
    {
        $filePaths = [
            __DIR__ . '/.gstraccini.toml',
            __DIR__ . '/.github/.gstraccini.toml'
        ];

        foreach ($filePaths as $filePath) {
            if (file_exists($filePath)) {
                return Toml::parseFile($filePath);
            }
        }

        throw new \Exception('Configuration file not found.');
    }

    public function get($key)
    {
        return $this->config[$key] ?? null;
    }

Screenshots or Diagrams

No response

Additional information

No response

gitauto-ai[bot] commented 3 weeks ago

Click the checkbox below to generate a PR!

@guibranco, You have 5 requests left in this cycle which refreshes on 2024-09-21 10:07:38+00:00. If you have any questions or concerns, please contact us at info@gitauto.ai.

gitauto-ai[bot] commented 2 weeks ago

Hello @guibranco, you have reached your request limit of 5, your cycle will refresh on 2024-09-21 10:07:38+00:00. Consider subscribing if you want more requests. If you have any questions or concerns, please contact us at info@gitauto.ai.