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

AJGranowski / preceding-tag-action / 17601874364

10 Sep 2025 03:04AM UTC coverage: 10.502%. First build
17601874364

Pull #14

github

web-flow
Merge 28847fc8f into 0fc5df55f
Pull Request #14: Add `include-ref` option

5 of 8 branches covered (62.5%)

Branch coverage included in aggregate %.

9 of 39 new or added lines in 3 files covered. (23.08%)

18 of 211 relevant lines covered (8.53%)

0.09 hits per line

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

1.92
/src/Input.ts
1
import type { getBooleanInput, getInput } from "@actions/core";
1✔
2
import type { context } from "@actions/github";
3

4
import type { Repository } from "./Repository";
5

6
type core_getBooleanInput = typeof getBooleanInput;
7
type core_getInput = typeof getInput;
8
type github_context = typeof context;
9

10
class Input {
×
11
    private readonly context: github_context;
×
NEW
12
    private readonly getBooleanInput: core_getBooleanInput;
×
NEW
13
    private readonly getInput: core_getInput;
×
NEW
14
    constructor(getInput: core_getInput, getBooleanInput: core_getBooleanInput, context: github_context) {
×
15
        this.context = context;
×
NEW
16
        this.getBooleanInput = getBooleanInput;
×
17
        this.getInput = getInput;
×
18
    }
×
19

20
    /**
21
     * Get the tag filtering regular expression, defaults to matching every non-zero string.
22
     */
23
    getFilter(): RegExp {
×
24
        const filterString = this.getInput("filter");
×
25
        if (filterString.length === 0) {
×
26
            return /^.+$/;
×
27
        }
×
28

29
        return new RegExp(filterString);
×
30
    }
×
31

32
    /**
33
     * Return the include-ref option, defaults to false.
34
     */
NEW
35
    getIncludeRef(): boolean {
×
NEW
36
        if (this.getInput("include-ref").length === 0) {
×
NEW
37
            return false;
×
NEW
38
        }
×
39

NEW
40
        return this.getBooleanInput("include-ref");
×
NEW
41
    }
×
42

43
    /**
44
     * Get the ref to get the preceding tag of. Defaults to HEAD if not supplied for some reason.
45
     */
46
    getRef(): string {
×
47
        const ref = this.getInput("ref");
×
48
        return ref.length > 0 ? ref : "HEAD";
×
49
    }
×
50

51
    /**
52
     * Generate a Repository object, either from the action inputs or the context this action is running in.
53
     */
54
    getRepository(): Repository {
×
55
        const inputString = this.getInput("repository");
×
56
        if (inputString.length === 0) {
×
57
            return {
×
58
                owner: this.context.repo.owner,
×
59
                repo: this.context.repo.repo
×
60
            };
×
61
        }
×
62

63
        const matcher = inputString.match(/^(?<owner>[^/]+)\/(?<repo>[^/]+)$/);
×
64
        if (matcher == null || matcher.groups == null) {
×
65
            throw new Error(`Invalid repository "${inputString}". Expected format {owner}/{repo}`);
×
66
        }
×
67

68
        return {
×
69
            owner: matcher.groups.owner,
×
70
            repo: matcher.groups.repo
×
71
        };
×
72
    }
×
73

74
    /**
75
     * Return the token if it exists, or undefined.
76
     */
NEW
77
    getToken(): string | undefined {
×
NEW
78
        const token = this.getInput("token");
×
NEW
79
        if (token.length === 0) {
×
NEW
80
            return undefined;
×
NEW
81
        }
×
82

NEW
83
        return token;
×
NEW
84
    }
×
85
}
×
86

87
export { Input };
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

© 2026 Coveralls, Inc