• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

samsmithnz / RepoAutomation / 3895898324

pending completion
3895898324

push

github

GitHub
Merge pull request #212 from samsmithnz/FixToLanguageTest

333 of 474 branches covered (70.25%)

Branch coverage included in aggregate %.

795 of 893 relevant lines covered (89.03%)

6.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.94
/src/RepoAutomation.Core/Helpers/GitHubFiles.cs
1
using RepoAutomation.Core.APIAccess;
2
using RepoAutomation.Core.Models;
3

4
namespace RepoAutomation.Core.Helpers
5
{
6
    public static class GitHubFiles
7
    {
8
        public async static Task<List<string>?> GetFiles(string? id, string? secret,
9
            string owner, string repository, string? file, string? extension, string path)
10
        {
5✔
11
            GitHubFile[]? searchResult = await GitHubApiAccess.GetFiles(id, secret,
5✔
12
                owner, repository, path);
5✔
13

14
            List<string> results = new();
5✔
15
            if (searchResult == null)
5!
16
            {
×
17
                return null;
×
18
            }
19
            else
20
            {
5✔
21
                foreach (GitHubFile gitHubFile in searchResult)
35✔
22
                {
10✔
23
                    if (file != null && gitHubFile.name == file)
10✔
24
                    {
2✔
25
                        results.Add(gitHubFile.name);
2✔
26
                    }
2✔
27
                    else if (extension != null && gitHubFile.name != null)
8✔
28
                    {
1✔
29
                        string[] splitFileName = gitHubFile.name.Split(".");
1✔
30
                        if (splitFileName.Length > 0 && splitFileName[^1] == extension)
1!
31
                        {
1✔
32
                            results.Add(gitHubFile.name);
1✔
33
                        }
1✔
34
                    }
1✔
35
                    else if (file == null && extension == null)
7✔
36
                    {
2✔
37
                        if (gitHubFile != null && gitHubFile.name != null)
2!
38
                        {
2✔
39
                            results.Add(gitHubFile.name);
2✔
40
                        }
2✔
41
                    }
2✔
42
                }
10✔
43
            }
5✔
44

45
            return results;
5✔
46
        }
5✔
47

48
        public async static Task<GitHubFile?> GetFileContents(string? id, string? secret,
49
            string owner, string repository, string filePath)
50
        {
4✔
51
            GitHubFile? file = await GitHubApiAccess.GetFile(id, secret,
4✔
52
                owner, repository, filePath);
4✔
53
            return file;
4✔
54
        }
4✔
55
    }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc