Skip to content

Commit

Permalink
old commit
Browse files Browse the repository at this point in the history
  • Loading branch information
foobar authored and fpicalausa committed Jan 7, 2024
1 parent 9b6dd8a commit aff9543
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 85 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ jobs:
name: Cleanup stale branches
runs-on: ubuntu-latest
steps:
- uses: fpicalausa/remove-stale-branches@master
- name: Checkout
uses: actions/checkout@v4
- uses: ./
with:
days-before-branch-stale: 15
dry-run: false
ignore-unknown-authors: true
default-recipient: fpicalausa
169 changes: 85 additions & 84 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34288,84 +34288,84 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.readBranches = void 0;
const GRAPHQL_QUERY = `query ($repo: String!, $owner: String!, $after: String) {
repository(name: $repo, owner: $owner) {
id
refs(
refPrefix: "refs/heads/",
first: 10,
after: $after,
) {
edges {
node {
name
prefix
... on Ref {
refUpdateRule {
allowsDeletions
}
}
target {
... on Commit {
oid
authoredDate
author {
email
user {
login
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
const GRAPHQL_QUERY = `query ($repo: String!, $owner: String!, $after: String) {
repository(name: $repo, owner: $owner) {
id
refs(
refPrefix: "refs/heads/",
first: 10,
after: $after,
) {
edges {
node {
name
prefix
... on Ref {
refUpdateRule {
allowsDeletions
}
}
target {
... on Commit {
oid
authoredDate
author {
email
user {
login
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}`;
const GRAPHQL_QUERY_WITH_ORG = `query ($repo: String!, $owner: String!, $organization: String!, $after: String) {
repository(name: $repo, owner: $owner) {
id
refs(
refPrefix: "refs/heads/",
first: 10,
after: $after,
) {
edges {
node {
name
prefix
... on Ref {
refUpdateRule {
allowsDeletions
}
}
target {
... on Commit {
oid
authoredDate
author {
email
user {
login
organization(login: $organization) {
id
}
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
const GRAPHQL_QUERY_WITH_ORG = `query ($repo: String!, $owner: String!, $organization: String!, $after: String) {
repository(name: $repo, owner: $owner) {
id
refs(
refPrefix: "refs/heads/",
first: 10,
after: $after,
) {
edges {
node {
name
prefix
... on Ref {
refUpdateRule {
allowsDeletions
}
}
target {
... on Commit {
oid
authoredDate
author {
email
user {
login
organization(login: $organization) {
id
}
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}`;
function readBranches(octokit, headers, repo, organization) {
var _a, _b, _c, _d;
Expand Down Expand Up @@ -34466,7 +34466,7 @@ const readBranches_1 = __nccwpck_require__(2996);
const core = __importStar(__nccwpck_require__(2186));
const date_fns_1 = __nccwpck_require__(3314);
function processBranch(plan, branch, commitComments, params) {
var _a, _b;
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
console.log("-> branch was last updated by " +
(((_a = branch.author) === null || _a === void 0 ? void 0 : _a.username) || ((_b = branch.author) === null || _b === void 0 ? void 0 : _b.email) || "(unknown user)") +
Expand All @@ -34478,7 +34478,7 @@ function processBranch(plan, branch, commitComments, params) {
}
if (plan.action === "mark stale") {
console.log("-> branch will be removed on " + (0, formatISO_1.default)(plan.cutoffTime));
console.log("-> marking branch as stale");
console.log("-> marking branch as stale (notifying: " + (((_c = branch.author) === null || _c === void 0 ? void 0 : _c.username) || params.defaultRecipient) + ")");
if (params.isDryRun) {
console.log("-> (doing nothing because of dry run flag)");
return;
Expand Down Expand Up @@ -34575,6 +34575,7 @@ function planBranchAction(now, branch, filters, commitComments, params) {
}
function removeStaleBranches(octokit, params) {
var e_1, _a;
var _b;
return __awaiter(this, void 0, void 0, function* () {
const headers = params.githubToken
? {
Expand Down Expand Up @@ -34617,13 +34618,13 @@ function removeStaleBranches(octokit, params) {
skip: "✅",
};
try {
for (var _b = __asyncValues((0, readBranches_1.readBranches)(octokit, headers, repo, params.protectedOrganizationName)), _c; _c = yield _b.next(), !_c.done;) {
const branch = _c.value;
if (!branch.author && !params.ignoreUnknownAuthors) {
for (var _c = __asyncValues((0, readBranches_1.readBranches)(octokit, headers, repo, params.protectedOrganizationName)), _d; _d = yield _c.next(), !_d.done;) {
const branch = _d.value;
if (!((_b = branch.author) === null || _b === void 0 ? void 0 : _b.username) && !params.ignoreUnknownAuthors) {
console.error("🛑 Failed to find author associated with branch " +
branch.branchName +
". Use ignore-unknown-authors if this is expected.");
throw new Error("Failed to find author for branch");
throw new Error("Failed to find author for branch " + branch.branchName);
}
const plan = yield planBranchAction(now.getTime(), branch, filters, commitComments, params);
core.startGroup(`${icons[plan.action]} branch ${branch.branchName}`);
Expand All @@ -34645,7 +34646,7 @@ function removeStaleBranches(octokit, params) {
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
Expand Down

1 comment on commit aff9543

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[stale:stale]

@fpicalausa Your branch stale hasn't been updated in the last 15 days and is marked as stale. It will be removed in a 7 days.
If you want to keep this branch around, add new commits to this branch or protect it.

Please sign in to comment.