mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-02 05:26:52 -04:00
Bumps the actions-deps group with 9 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/github-script](https://github.com/actions/github-script) | `8.0.0` | `9.0.0` | | [step-security/harden-runner](https://github.com/step-security/harden-runner) | `2.15.0` | `2.19.0` | | [actions/setup-go](https://github.com/actions/setup-go) | `6.3.0` | `6.4.0` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.0` | `7.0.1` | | [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) | `7.0.0` | `7.2.1` | | [actions/dependency-review-action](https://github.com/actions/dependency-review-action) | `4.8.3` | `4.9.0` | | [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) | `3.10.0` | `4.1.1` | | [anchore/sbom-action](https://github.com/anchore/sbom-action) | `0.23.0` | `0.24.0` | | [github/codeql-action](https://github.com/github/codeql-action) | `4.32.4` | `4.35.3` | Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](ed597411d8...3a2844b7e9) Updates `step-security/harden-runner` from 2.15.0 to 2.19.0 - [Release notes](https://github.com/step-security/harden-runner/releases) - [Commits](a90bcbc653...8d3c67de8e) Updates `actions/setup-go` from 6.3.0 to 6.4.0 - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](4b73464bb3...4a3601121d) Updates `actions/upload-artifact` from 7.0.0 to 7.0.1 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](bbbca2ddaa...043fb46d1a) Updates `goreleaser/goreleaser-action` from 7.0.0 to 7.2.1 - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](ec59f474b9...1a80836c5c) Updates `actions/dependency-review-action` from 4.8.3 to 4.9.0 - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](05fe457637...2031cfc080) Updates `sigstore/cosign-installer` from 3.10.0 to 4.1.1 - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](d7543c93d8...cad07c2e89) Updates `anchore/sbom-action` from 0.23.0 to 0.24.0 - [Release notes](https://github.com/anchore/sbom-action/releases) - [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md) - [Commits](17ae174017...e22c389904) Updates `github/codeql-action` from 4.32.4 to 4.35.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](89a39a4e59...e46ed2cbd0) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: step-security/harden-runner dependency-version: 2.19.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps - dependency-name: actions/setup-go dependency-version: 6.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps - dependency-name: actions/upload-artifact dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions-deps - dependency-name: goreleaser/goreleaser-action dependency-version: 7.2.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps - dependency-name: actions/dependency-review-action dependency-version: 4.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps - dependency-name: sigstore/cosign-installer dependency-version: 4.1.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: anchore/sbom-action dependency-version: 0.24.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps - dependency-name: github/codeql-action dependency-version: 4.35.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com>
222 lines
9.1 KiB
YAML
222 lines
9.1 KiB
YAML
name: Release Proposal Approval Tracker
|
|
|
|
on:
|
|
pull_request_review:
|
|
types: [submitted, dismissed]
|
|
pull_request:
|
|
types: [labeled, unlabeled, synchronize, closed]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
check-approvals:
|
|
name: Track Maintainer Approvals
|
|
runs-on: ubuntu-latest
|
|
# Only run on PRs with release-proposal label
|
|
if: contains(github.event.pull_request.labels.*.name, 'release-proposal') && github.event.pull_request.state == 'open'
|
|
|
|
steps:
|
|
- name: Check approvals and update PR
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
env:
|
|
MAINTAINER_LOGINS: ${{ secrets.MAINTAINER_LOGINS }}
|
|
with:
|
|
script: |
|
|
const pr = context.payload.pull_request;
|
|
|
|
// Extract version from PR title (e.g., "Release Proposal: v1.2.3")
|
|
const versionMatch = pr.title.match(/Release Proposal:\s*(v[\d.]+(?:-[\w.]+)?)/);
|
|
const commitMatch = pr.body.match(/\*\*Target Commit:\*\*\s*`([a-f0-9]+)`/);
|
|
|
|
if (!versionMatch || !commitMatch) {
|
|
console.log('Could not extract version from title or commit from body');
|
|
return;
|
|
}
|
|
|
|
const version = versionMatch[1];
|
|
const targetCommit = commitMatch[1];
|
|
|
|
console.log(`Version: ${version}, Target Commit: ${targetCommit}`);
|
|
|
|
// Get all reviews
|
|
const reviews = await github.rest.pulls.listReviews({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
pull_number: pr.number
|
|
});
|
|
|
|
// Get list of maintainers
|
|
const maintainerLoginsRaw = process.env.MAINTAINER_LOGINS || '';
|
|
const maintainerLogins = maintainerLoginsRaw
|
|
.split(/[,;]/)
|
|
.map(login => login.trim())
|
|
.filter(login => login.length > 0);
|
|
|
|
console.log(`Maintainer logins: ${maintainerLogins.join(', ')}`);
|
|
|
|
// Get the latest review from each user
|
|
const latestReviewsByUser = {};
|
|
reviews.data.forEach(review => {
|
|
const username = review.user.login;
|
|
if (!latestReviewsByUser[username] || new Date(review.submitted_at) > new Date(latestReviewsByUser[username].submitted_at)) {
|
|
latestReviewsByUser[username] = review;
|
|
}
|
|
});
|
|
|
|
// Count approvals from maintainers
|
|
const maintainerApprovals = Object.entries(latestReviewsByUser)
|
|
.filter(([username, review]) =>
|
|
maintainerLogins.includes(username) &&
|
|
review.state === 'APPROVED'
|
|
)
|
|
.map(([username, review]) => username);
|
|
|
|
const approvalCount = maintainerApprovals.length;
|
|
console.log(`Found ${approvalCount} maintainer approvals from: ${maintainerApprovals.join(', ')}`);
|
|
|
|
// Get current labels
|
|
const currentLabels = pr.labels.map(label => label.name);
|
|
const hasApprovedLabel = currentLabels.includes('approved');
|
|
const hasAwaitingApprovalLabel = currentLabels.includes('awaiting-approval');
|
|
|
|
if (approvalCount >= 2 && !hasApprovedLabel) {
|
|
console.log('✅ Quorum reached! Updating PR...');
|
|
|
|
// Remove awaiting-approval label if present
|
|
if (hasAwaitingApprovalLabel) {
|
|
await github.rest.issues.removeLabel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
name: 'awaiting-approval'
|
|
}).catch(e => console.log('Label not found:', e.message));
|
|
}
|
|
|
|
// Add approved label
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
labels: ['approved']
|
|
});
|
|
|
|
// Add comment with tagging instructions
|
|
const approversList = maintainerApprovals.map(u => `@${u}`).join(', ');
|
|
const commentBody = [
|
|
'## ✅ Approval Quorum Reached',
|
|
'',
|
|
`This release proposal has been approved by ${approvalCount} maintainers: ${approversList}`,
|
|
'',
|
|
'### Tagging Instructions',
|
|
'',
|
|
'A maintainer should now create and push the signed tag:',
|
|
'',
|
|
'```bash',
|
|
`git checkout ${targetCommit}`,
|
|
`git tag -s ${version} -m "Release ${version}"`,
|
|
`git push origin ${version}`,
|
|
`git checkout -`,
|
|
'```',
|
|
'',
|
|
'The release workflow will automatically start when the tag is pushed.'
|
|
].join('\n');
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
body: commentBody
|
|
});
|
|
|
|
console.log('Posted tagging instructions');
|
|
} else if (approvalCount < 2 && hasApprovedLabel) {
|
|
console.log('⚠️ Approval count dropped below quorum, removing approved label');
|
|
|
|
// Remove approved label
|
|
await github.rest.issues.removeLabel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
name: 'approved'
|
|
}).catch(e => console.log('Label not found:', e.message));
|
|
|
|
// Add awaiting-approval label
|
|
if (!hasAwaitingApprovalLabel) {
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
labels: ['awaiting-approval']
|
|
});
|
|
}
|
|
} else {
|
|
console.log(`⏳ Waiting for more approvals (${approvalCount}/2 required)`);
|
|
}
|
|
|
|
handle-pr-closed:
|
|
name: Handle PR Closed Without Tag
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
contains(github.event.pull_request.labels.*.name, 'release-proposal') &&
|
|
github.event.action == 'closed' && !contains(github.event.pull_request.labels.*.name, 'released')
|
|
|
|
steps:
|
|
- name: Add cancelled label and comment
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
with:
|
|
script: |
|
|
const pr = context.payload.pull_request;
|
|
|
|
// Check if the release-in-progress label is present
|
|
const hasReleaseInProgress = pr.labels.some(label => label.name === 'release-in-progress');
|
|
|
|
if (hasReleaseInProgress) {
|
|
// PR was closed while release was in progress - this is unusual
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
body: '⚠️ **Warning:** This PR was closed while a release was in progress. This may indicate an error. Please verify the release status.'
|
|
});
|
|
} else {
|
|
// PR was closed before tag was created - this is normal cancellation
|
|
const versionMatch = pr.title.match(/Release Proposal:\s*(v[\d.]+(?:-[\w.]+)?)/);
|
|
const version = versionMatch ? versionMatch[1] : 'unknown';
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
body: `## 🚫 Release Proposal Cancelled\n\nThis release proposal for ${version} was closed without creating the tag.\n\nIf you want to proceed with this release later, you can create a new release proposal.`
|
|
});
|
|
}
|
|
|
|
// Add cancelled label
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
labels: ['cancelled']
|
|
});
|
|
|
|
// Remove other workflow labels if present
|
|
const labelsToRemove = ['awaiting-approval', 'approved', 'release-in-progress'];
|
|
for (const label of labelsToRemove) {
|
|
try {
|
|
await github.rest.issues.removeLabel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
name: label
|
|
});
|
|
} catch (e) {
|
|
console.log(`Label ${label} not found or already removed`);
|
|
}
|
|
}
|
|
|
|
console.log('Added cancelled label and cleaned up workflow labels');
|
|
|