mirror of
https://github.com/actions/labeler.git
synced 2025-12-11 12:07:32 +00:00
Use correct branch name and update tests
This commit is contained in:
@@ -105,7 +105,7 @@ describe("run", () => {
|
||||
});
|
||||
|
||||
it("adds labels based on the branch names that match the glob pattern", async () => {
|
||||
github.context.ref = "test/testing-time";
|
||||
github.context.payload.pull_request!.head = {ref: "test/testing-time"};
|
||||
usingLabelerConfigYaml("branches.yml");
|
||||
await run();
|
||||
|
||||
@@ -119,7 +119,7 @@ describe("run", () => {
|
||||
});
|
||||
|
||||
it("adds labels based on branch names that match different glob patterns", async () => {
|
||||
github.context.ref = "my/feature/that-i-like";
|
||||
github.context.payload.pull_request!.head = {ref: "my/feature/that-i-like"};
|
||||
usingLabelerConfigYaml("branches.yml");
|
||||
await run();
|
||||
|
||||
|
||||
@@ -216,10 +216,8 @@ function checkAll(changedFiles: string[], globs: string[]): boolean {
|
||||
|
||||
function checkBranch(glob: string): boolean {
|
||||
const matcher = new Minimatch(glob);
|
||||
const branchName = github.context.ref;
|
||||
const branchName2 = github.context.payload.pull_request!.head.ref;
|
||||
const branchName = github.context.payload.pull_request!.head.ref;
|
||||
core.debug(` checking "branch" pattern against ${branchName}`);
|
||||
core.debug(` - but we should be checking ${branchName2}`);
|
||||
core.debug(` - ${printPattern(matcher)}`);
|
||||
if (!matcher.match(branchName)) {
|
||||
core.debug(` ${printPattern(matcher)} did not match`);
|
||||
|
||||
Reference in New Issue
Block a user