# GitHub Actions Setup

This repository uses GitHub Actions to automatically update fullPage.js and release new versions.

## Workflows

### 1. Check Latest fullPage.js (`check-latest-fullpage.yml`)

**Triggers:**
- Daily at 2 AM UTC (scheduled)
- Manual trigger from GitHub Actions tab

**What it does:**
1. Checks the current fullPage.js version in `package.json`
2. Fetches the latest fullPage.js version from npm registry
3. If there's a newer version, creates a Pull Request to update it
4. The PR includes proper labels and description

### 2. Auto Update fullPage.js (`auto-update-fullpage.yml`)

**Triggers:**
- When a PR that modifies `package.json` is merged to `main`

**What it does:**
1. Detects if fullPage.js version was updated in the merged PR
2. If yes, builds the project and runs tests
3. Bumps the patch version of react-fullpage
4. Creates a GitHub release
5. Publishes to npm

### 3. Manual Update (`manual-update.yml`)

**Triggers:**
- Manual workflow dispatch from GitHub Actions tab

**What it does:**
1. Allows you to specify a fullPage.js version to update to
2. Updates the dependency and rebuilds
3. Creates a release and publishes to npm

## Complete Automated Flow

Here's how the full automation works:

```
1. Daily Check (2 AM UTC)
   ↓
2. Check Latest fullPage.js workflow runs
   ↓
3. If new version found → Creates PR
   ↓
4. You review and merge the PR
   ↓
5. Auto Update workflow triggers
   ↓
6. Builds, tests, and releases automatically
   ↓
7. New version published to npm
```

## How It Gets the Latest Version

The `check-latest-fullpage.yml` workflow uses:
- `npm view fullpage.js version` - Gets the latest version from npm registry
- Compares it with the current version in `package.json`
- Creates a PR if there's a difference

This is different from Dependabot because:
- **Dependabot**: Only checks when you have a `package-lock.json` and runs on a schedule
- **Our workflow**: Actively checks npm registry and creates PRs with proper descriptions

## Setup Requirements

### 1. NPM Token
You need to add an NPM token to your repository secrets:

1. Go to your npm account settings
2. Generate a new access token
3. Add it to your GitHub repository secrets as `NPM_TOKEN`

### 2. Repository Permissions
Make sure the GitHub Actions have write permissions to:
- Create releases
- Push to the repository
- Publish to npm
- Create pull requests

## How to Use

### Automatic Updates (Recommended)
1. The daily workflow will automatically check for fullPage.js updates
2. When a new version is found, it creates a PR
3. Review the PR and merge it
4. The auto-update workflow will trigger and create a release

### Manual Updates
1. Go to Actions tab in your repository
2. Select "Manual fullPage.js Update"
3. Click "Run workflow"
4. Enter the fullPage.js version you want to update to
5. Click "Run workflow"

### Manual Check for Updates
1. Go to Actions tab in your repository
2. Select "Check Latest fullPage.js"
3. Click "Run workflow"
4. This will check for updates and create a PR if needed

## Dependabot Configuration

The `.github/dependabot.yml` file is configured to:
- Check for npm updates daily
- Only create PRs for dependency updates
- Add appropriate labels and assignees

## Benefits

- **Always up-to-date**: Users get the latest fullPage.js versions
- **Automated**: No manual intervention needed for patch/minor updates
- **Tested**: All updates go through the build and test process
- **Versioned**: Each update creates a new patch version
- **Documented**: Release notes are automatically generated
- **Proactive**: Actively checks for updates instead of waiting for Dependabot 