-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathgithub-actions-standards.mdc
More file actions
51 lines (42 loc) · 2.12 KB
/
Copy pathgithub-actions-standards.mdc
File metadata and controls
51 lines (42 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
description:
globs: .github/workflows/*.yml
alwaysApply: false
---
# GitHub Actions Standards
Ensures GitHub Actions workflows follow best practices and use the latest action versions.
## Rule Details
- **Name:** github_actions_standards
- **Description:** Enforce standards for GitHub Actions workflows
## Filters
- file extension pattern: `\\.ya?ml$`
- file path pattern: `\\.github/workflows/`
## Enforcement Checks
- Conditions:
- pattern `uses:\\s*actions/upload-artifact@v[123]` – Use actions/upload-artifact@v4 instead of older versions. Version 3 is deprecated: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
- pattern `uses:\\s*actions/download-artifact@v[123]` – Use actions/download-artifact@v4 instead of older versions.
- pattern `uses:\\s*actions/checkout@v[12]` – Consider using actions/checkout@v4 for the latest features and security updates.
## Suggestions
- Guidance:
**GitHub Actions Best Practices:**
- **Latest Action Versions:** Always use the latest stable versions of GitHub Actions.
- `actions/checkout@v4`
- `actions/upload-artifact@v4`
- `actions/download-artifact@v4`
- `actions/setup-node@v4`
- `actions/setup-python@v5`
- **Workflow Structure:** Organize workflows with clear job names and step descriptions.
- **Caching:** Implement caching for dependencies to speed up workflows.
- **Security:** Use `GITHUB_TOKEN` with minimum required permissions.
- **Artifacts:** Use descriptive names for artifacts and set appropriate retention periods.
- **Matrix Strategy:** Use matrix builds for testing across multiple environments.
- **Timeouts:** Set appropriate timeouts for jobs to prevent hanging workflows.
## Validation Checks
- Conditions:
- pattern `uses:\\s*actions/upload-artifact@v4` – Good job using the latest version of actions/upload-artifact!
- pattern `uses:\\s*actions/download-artifact@v4` – Good job using the latest version of actions/download-artifact!
- pattern `uses:\\s*actions/checkout@v[34]` – Good job using a recent version of actions/checkout!
## Metadata
- Priority: high
- Version: 1.1
- Tags: ci/cd, github, automation