|
| 1 | +## JSON Schema Website CI/CD Workflow Guidelines |
| 2 | + |
| 3 | +### Overview |
| 4 | + |
| 5 | +This document outlines the guidelines for contributing to and maintaining GitHub Actions workflows in the JSON Schema Website project. Adherence to these guidelines ensures consistency, efficiency, and ease of maintenance across our CI/CD processes. |
| 6 | + |
| 7 | +### General Principles |
| 8 | + |
| 9 | +- **Change Management**: Modifications to files in this directory are closely monitored. Changes will trigger unauthorized file changes workflow during pull request checks. Only make changes when explicitly advised by a project contributor or maintainer. |
| 10 | +- **Documentation and Naming**: Use descriptive, self-explanatory names for workflows, jobs, and steps. Include clear comments within workflow files to explain complex configurations. |
| 11 | + |
| 12 | +### YAML Workflow File Structure |
| 13 | + |
| 14 | +Our YAML files are organized based on specific roles and event triggers. When creating or modifying workflows, ensure that: |
| 15 | +- The file roles described below are strictly maintained. |
| 16 | +- Job sequences within workflows are preserved using [GitHub Action job dependencies](https://docs.github.com/en/actions/using-workflows/using-jobs-in-a-workflow#defining-prerequisite-jobs). |
| 17 | + |
| 18 | +### File Categorization |
| 19 | + |
| 20 | +Organize workflow files based on their primary event trigger: |
| 21 | + |
| 22 | +- **Issue Workflows**: |
| 23 | + - [Issue Workflow](./issue.yml): Handles issue-related events such as opening, closing, or labeling issues. |
| 24 | + |
| 25 | +- **Pull Request Workflows**: |
| 26 | + - [CI Workflow](./ci.yml): Runs for all contributors on pull requests, performing code-quality checks, unauthorized file changes detection, and build processes. |
| 27 | + - [PR Interaction Workflow](./pull-request-target.yml): Contains workflows specifically for first-time contributors, such as welcome messages. |
| 28 | + |
| 29 | +### Exceptions to File Categorization |
| 30 | + |
| 31 | +Separate files may be created for workflows that: |
| 32 | + |
| 33 | +- Require unique `cron` schedules for periodic execution. |
| 34 | + Examples: |
| 35 | + - [Link Checker](./link-checker.yml): Periodically checks for broken links in the repository. |
| 36 | + - [Mark stale issues and pull requests](./stale-issues-prs.yml): Automatically labels and closes stale issues and PRs. |
| 37 | + - [Dependabot](../dependabot.yml): Keeps dependencies up-to-date. |
| 38 | + |
| 39 | +- Need specific `paths` triggers, activating only when files in particular directories are modified. |
| 40 | + Example: |
| 41 | + - [New Implementation Commenter](./new-implementation.yml): Adds comments when new implementation files are added. |
| 42 | + |
| 43 | +- Only work correctly if they have a dedicated file. |
| 44 | + Examples: |
| 45 | + - [Preview Deployment](./preview-deployment.yml): Deploys preview environments for pull requests. |
| 46 | + - [Production Deployment](./production-deployment.yml): Handles production deployments. |
| 47 | + - [CodeQL Code Scanning](./codeql.yml): Performs code security analysis. |
| 48 | + - [Check PR Dependencies](./pr-dependencies.yml): Enforces dependencies between PRs based on opening comments. |
| 49 | + |
| 50 | +### Workflow Maintenance |
| 51 | + |
| 52 | +To ensure the efficiency and reliability of our workflows, follow these maintenance guidelines: |
| 53 | + |
| 54 | +- **Regular Review**: Review and update workflows at least quarterly to incorporate new features or best practices. |
| 55 | +- **Dependency Updates**: Keep workflow dependencies up-to-date by reviewing and applying Dependabot suggestions promptly. |
| 56 | +- **Documentation**: Update workflow documentation immediately after any changes or modifications to keep it current. |
| 57 | +- **Performance Monitoring**: Regularly check workflow run times and optimize where possible to reduce GitHub Actions usage. |
| 58 | +- **Security Checks**: Ensure that workflows using secrets or accessing sensitive data are properly secured and follow least privilege principles. |
| 59 | + |
| 60 | +These guidelines aim to maintain the integrity and efficiency of our CI/CD processes. Always consult with the team before making significant changes to any workflow. |
0 commit comments