Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/new_pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: New pipeline proposal
description: Propose a new pipeline for incorporation into nf-core
title: "New pipeline: nf-core/<add provisional pipeline name here>"
labels: "new-pipeline,proposed"
projects: nf-core/104
labels: ["new-pipeline", "proposed"]
projects: ["nf-core/104"]
body:
- type: input
attributes:
Expand Down
7 changes: 2 additions & 5 deletions .github/ISSUE_TEMPLATE/new_rfc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: New RFC proposal
description: Propose a major new functionality for incorporation into nf-core
title: "New RFC: <short sentence describing proposal>"
labels: "new-rfc,proposed"
projects: nf-core/127
assignees:
- nf-core/core
labels: ["new-rfc", "proposed"]
projects: ["nf-core/127"]
body:
- type: checkboxes
attributes:
Expand All @@ -28,7 +26,6 @@ body:
attributes:
label: Background & Motivation
description: Provide the context of the proposal, summarising the existing status-quo or issues.
placeholder:
validations:
required: true
- type: textarea
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/new_special_interest_group.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: New special interest group proposal
description: Propose a new special interest group for incorporation into nf-core
title: "New special interest group: <PROVISIONAL SPECIAL INTEREST GROUP NAME>"
labels: "new-special-interest-group,proposed"
projects: nf-core/105
labels: ["new-special-interest-group", "proposed"]
projects: ["nf-core/105"]
body:
- type: checkboxes
attributes:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Dependencies
node_modules/

# Coverage reports
coverage/

# Jest cache
.cache/

# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
151 changes: 151 additions & 0 deletions .github/workflows/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# GitHub Approval Automation

This module contains the `ApprovalManager` class used by GitHub Actions workflows to automate the approval process for pipeline proposals and RFCs.

## Files

- `approval.js` - The main ApprovalManager class
- `approval.test.js` - Unit tests for ApprovalManager class
- `workflow-integration.test.js` - Integration tests for complete workflow scenarios
- `package.json` - Node.js package configuration with Jest setup
- `README.md` - This documentation file

## ApprovalManager Class

The `ApprovalManager` class handles:

- Fetching team members from GitHub organization teams
- Processing comments to track approvals and rejections via `/approve` and `/reject` commands
- Updating issue status and labels based on approval state
- Managing status comments on issues

### Usage Scenarios

#### Pipeline Proposals

- **Approval Criteria**: Either 2 core team members OR 1 core team member + 1 maintainer
- **Issue Title Pattern**: Must start with "New Pipeline"
- **Team Roles**: Both core team and maintainers can vote

#### RFC Proposals

- **Approval Criteria**: Quorum of core team members (Math.ceil(coreTeamMembers.length / 2))
- **Issue Title Pattern**: Must start with "New RFC"
- **Team Roles**: Only core team members can vote

## Running Tests

### Prerequisites

Install Node.js and npm, then install Jest:

```bash
npm install
```

### Test Commands

```bash
# Run all tests
npm test

# Run tests in watch mode (reruns on file changes)
npm test:watch

# Run tests with coverage report
npm test:coverage
```

## Test Suite

The test suite includes both unit tests and integration tests:

### Unit Tests (`approval.test.js`)

Tests individual methods and functionality of the ApprovalManager class.

### Integration Tests (`workflow-integration.test.js`)

End-to-end tests that simulate complete workflow scenarios as they would run in GitHub Actions.

## Test Coverage

The combined test suites cover:

### Core Functionality

- ✅ Constructor initialization
- ✅ Team member fetching from GitHub API
- ✅ Comment processing with `/approve` and `/reject` commands
- ✅ Status comment updates
- ✅ Issue label management

### Pipeline Proposal Scenarios

- ✅ Approval with 2 core members
- ✅ Approval with 1 core + 1 maintainer
- ✅ No approval with only 1 core member
- ✅ No approval with only maintainers

### RFC Proposal Scenarios

- ✅ Approval with core team quorum
- ✅ No approval without quorum
- ✅ Quorum calculation for different team sizes
- ✅ Ignoring maintainer votes (core-only)

### Edge Cases

- ✅ Case-insensitive commands (`/APPROVE`, `/reject`)
- ✅ Commands only at start of line
- ✅ Multiple commands from same user
- ✅ Multiple commands within same comment
- ✅ Non-team member comments (ignored)
- ✅ Empty or malformed comments
- ✅ Mixed line endings
- ✅ Users in both core and maintainer teams

### Error Handling

- ✅ GitHub API errors
- ✅ Empty comment arrays
- ✅ Null/undefined comment bodies
- ✅ Malformed regex patterns

## Command Format

The approval system recognizes these commands when they appear at the start of a line in a comment:

- `/approve` - Approve the proposal
- `/reject` - Reject the proposal

Commands are case-insensitive and can include additional text after the command.

### Examples

```
/approve
```

```
/approve This looks good to me!
```

```
/reject
This needs more work before approval.
```

```
I have some concerns.
/reject
```

## Status Labels

The system manages these issue labels:

- `proposed` - Initial state for new proposals
- `accepted` - Proposal has sufficient approvals
- `turned-down` - Proposal was rejected
- `timed-out` - Proposal expired without sufficient votes
Loading