Compare commits
1 Commits
main
...
delete_fil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97c8be58b7 |
61
.github/workflows/stale_pr_close.yml
generated
vendored
61
.github/workflows/stale_pr_close.yml
generated
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Scheduled run: fetch all open PRs ---
|
// --- Scheduled run: check all stale PRs ---
|
||||||
const { data: prs } = await github.rest.pulls.list({
|
const { data: prs } = await github.rest.pulls.list({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@@ -47,63 +47,8 @@ jobs:
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (const pr of prs) {
|
for (const pr of prs) {
|
||||||
const labels = pr.labels.map(l => l.name);
|
const hasStale = pr.labels.some(l => l.name === "stale");
|
||||||
const hasStale = labels.includes("stale");
|
if (!hasStale) continue;
|
||||||
const hasKeepOpen = labels.includes("keep-open");
|
|
||||||
|
|
||||||
// -------------------------------------------------------
|
|
||||||
// NEW: Auto-label PRs with no activity in the last 14 days
|
|
||||||
// -------------------------------------------------------
|
|
||||||
if (!hasStale && !hasKeepOpen) {
|
|
||||||
// Find the most recent commit date
|
|
||||||
const { data: commits } = await github.rest.pulls.listCommits({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
pull_number: pr.number
|
|
||||||
});
|
|
||||||
const lastCommitDate = commits.length > 0
|
|
||||||
? new Date(commits[commits.length - 1].commit.author.date)
|
|
||||||
: new Date(pr.created_at);
|
|
||||||
|
|
||||||
// Find the most recent non-bot comment date
|
|
||||||
const { data: comments } = await github.rest.issues.listComments({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
issue_number: pr.number,
|
|
||||||
per_page: 100
|
|
||||||
});
|
|
||||||
const humanComments = comments.filter(c => c.user?.type !== "Bot");
|
|
||||||
const lastCommentDate = humanComments.length > 0
|
|
||||||
? new Date(humanComments[humanComments.length - 1].created_at)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
// Most recent activity across commits and comments
|
|
||||||
const lastActivityDate = lastCommentDate && lastCommentDate > lastCommitDate
|
|
||||||
? lastCommentDate
|
|
||||||
: lastCommitDate;
|
|
||||||
|
|
||||||
const daysSinceActivity = (now - lastActivityDate) / (1000 * 60 * 60 * 24);
|
|
||||||
|
|
||||||
if (daysSinceActivity > 14) {
|
|
||||||
await github.rest.issues.addLabels({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
issue_number: pr.number,
|
|
||||||
labels: ["stale"]
|
|
||||||
});
|
|
||||||
// The pull_request_target labeled event will fire the comment automatically.
|
|
||||||
// Skip further processing for this PR in this run.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not stale, nothing else to do for this PR.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------
|
|
||||||
// EXISTING: Manage already-stale PRs
|
|
||||||
// -------------------------------------------------------
|
|
||||||
if (!hasStale) continue; // has keep-open but not stale — skip
|
|
||||||
|
|
||||||
// Get timeline events to find when stale label was added
|
// Get timeline events to find when stale label was added
|
||||||
const { data: events } = await github.rest.issues.listEvents({
|
const { data: events } = await github.rest.issues.listEvents({
|
||||||
|
|||||||
@@ -22,20 +22,27 @@ setup_deb822_repo \
|
|||||||
|
|
||||||
msg_info "Installing step-ca and step-cli"
|
msg_info "Installing step-ca and step-cli"
|
||||||
$STD apt install -y step-ca step-cli
|
$STD apt install -y step-ca step-cli
|
||||||
|
msg_ok "Installed step-ca and step-cli"
|
||||||
|
|
||||||
|
msg_info "Define smallstep environment variables"
|
||||||
STEPHOME="/root/.step"
|
STEPHOME="/root/.step"
|
||||||
$STD export STEPPATH=/etc/step-ca
|
$STD export STEPPATH=/etc/step-ca
|
||||||
$STD export STEPHOME=$STEPHOME
|
$STD export STEPHOME=$STEPHOME
|
||||||
|
msg_ok "Defined smallstep environment variables"
|
||||||
|
|
||||||
|
msg_info "Add smallstep environment variables to /etc/profile"
|
||||||
$STD sed -i '1i export STEPPATH=/etc/step-ca' /etc/profile
|
$STD sed -i '1i export STEPPATH=/etc/step-ca' /etc/profile
|
||||||
$STD sed -i '1i export STEPHOME=/root/.step' /etc/profile
|
$STD sed -i '1i export STEPHOME=/root/.step' /etc/profile
|
||||||
|
msg_ok "Added smallstep environment variables to /etc/profile"
|
||||||
|
|
||||||
|
msg_info "Authorize step-ca binary with low port-binding capabilities"
|
||||||
$STD setcap CAP_NET_BIND_SERVICE=+eip $(which step-ca)
|
$STD setcap CAP_NET_BIND_SERVICE=+eip $(which step-ca)
|
||||||
|
msg_ok "Authorized low port-binding capabilities"
|
||||||
|
|
||||||
|
msg_info "Add a smallstep CA service user - Will only be used by systemd to manage the CA"
|
||||||
$STD useradd --user-group --system --home $(step path) --shell /bin/false step
|
$STD useradd --user-group --system --home $(step path) --shell /bin/false step
|
||||||
msg_ok "Installed step-ca and step-cli"
|
msg_ok "Created smallstep CA service user"
|
||||||
|
|
||||||
msg_info "Initializing step-ca"
|
|
||||||
DeploymentType="standalone"
|
DeploymentType="standalone"
|
||||||
FQDN=$(hostname -f)
|
FQDN=$(hostname -f)
|
||||||
DomainName=$(hostname -d)
|
DomainName=$(hostname -d)
|
||||||
@@ -70,6 +77,7 @@ X509DefaultDur=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "step
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
msg_info "Initializing step-ca"
|
||||||
EncryptionPwdDir="$(step path)/encryption"
|
EncryptionPwdDir="$(step path)/encryption"
|
||||||
PwdFile="$EncryptionPwdDir/ca.pwd"
|
PwdFile="$EncryptionPwdDir/ca.pwd"
|
||||||
ProvisionerPwdFile="$EncryptionPwdDir/provisioner.pwd"
|
ProvisionerPwdFile="$EncryptionPwdDir/provisioner.pwd"
|
||||||
@@ -92,19 +100,25 @@ $STD step ca init \
|
|||||||
ln -s "$PwdFile" "$(step path)/password.txt"
|
ln -s "$PwdFile" "$(step path)/password.txt"
|
||||||
chown -R step:step $(step path)
|
chown -R step:step $(step path)
|
||||||
chmod -R 700 $(step path)
|
chmod -R 700 $(step path)
|
||||||
|
msg_ok "Initialized step-ca"
|
||||||
|
|
||||||
|
msg_info "Add ACME provisioner"
|
||||||
$STD step ca provisioner add "$AcmeProvisioner" --type ACME --admin-name "$AcmeProvisioner"
|
$STD step ca provisioner add "$AcmeProvisioner" --type ACME --admin-name "$AcmeProvisioner"
|
||||||
|
msg_ok "Added ACME provisioner"
|
||||||
|
|
||||||
|
msg_info "Update provisioner configurations"
|
||||||
$STD step ca provisioner update "$PKIProvisioner" \
|
$STD step ca provisioner update "$PKIProvisioner" \
|
||||||
--x509-min-dur=$X509MinDur \
|
--x509-min-dur=$X509MinDur \
|
||||||
--x509-max-dur=$X509MaxDur \
|
--x509-max-dur=$X509MaxDur \
|
||||||
--x509-default-dur=$X509DefaultDur \
|
--x509-default-dur=$X509DefaultDur \
|
||||||
--allow-renewal-after-expiry
|
--allow-renewal-after-expiry
|
||||||
|
|
||||||
$STD step ca provisioner update "$AcmeProvisioner" \
|
$STD step ca provisioner update "$AcmeProvisioner" \
|
||||||
--x509-min-dur=$X509MinDur \
|
--x509-min-dur=$X509MinDur \
|
||||||
--x509-max-dur=$X509MaxDur \
|
--x509-max-dur=$X509MaxDur \
|
||||||
--x509-default-dur=$X509DefaultDur \
|
--x509-default-dur=$X509DefaultDur \
|
||||||
--allow-renewal-after-expiry
|
--allow-renewal-after-expiry
|
||||||
msg_ok "Initialized step-ca"
|
msg_ok "Updated provisioner configurations"
|
||||||
|
|
||||||
msg_info "Start step-ca as a Daemon"
|
msg_info "Start step-ca as a Daemon"
|
||||||
cat <<'EOF' >/etc/systemd/system/step-ca.service
|
cat <<'EOF' >/etc/systemd/system/step-ca.service
|
||||||
|
|||||||
Reference in New Issue
Block a user