Skip to content

Commit 52d02cf

Browse files
authored
Merge pull request #42 from camihmerhar/Updates-Sub-OD-4.1.1-4.1.8
Updated content for 4.1.1-4.1.8
2 parents d68937e + 14af8bd commit 52d02cf

File tree

1 file changed

+95
-1
lines changed

1 file changed

+95
-1
lines changed

learn-pr/github/manage-github-actions-enterprise/includes/manage-actions-workflows.md

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ Once a workflow template is created, users in your organization can find it unde
111111

112112
:::image type="content" source="../media/workflow-template.png" alt-text="Workflow template example." border="false":::
113113

114-
<!-- INFOMAGNUS UPDATES for sub OD 4.1.8. go here. Source Material: Infomagnus team to find source material and cite it. -->
114+
<!-- INFOMAGNUS UPDATES for sub OD 4.1.8. go here. Source Material: Infomagnus team to find source material and cite it.
115+
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets-->
116+
115117
## Reusable Templates for Actions and Workflows
116118

117119
GitHub Actions allows for **workflow automation**, and a key part of managing workflows efficiently is using **reusable templates**. Reusable templates help standardize and streamline development across multiple repositories, reducing redundancy and improving maintainability.
@@ -248,3 +250,95 @@ By leveraging workflow templates, enterprises can:
248250
- Enforce best practices across repositories.
249251
- Accelerate onboarding and setup for new projects.
250252
- Maintain consistency in CI/CD processes.
253+
254+
255+
## Rule sets and Actions
256+
### Repository Rule Sets
257+
Repository rule sets are part of GitHub’s branch protection rules and repository protection features introduced to enforce policies for branches and tags across repositories. They allow you to standardize configurations across multiple branches or an entire organization. Defines reusable branch protection and tag protection rules. You can apply them to multiple repositories, branches, or tag patterns. Rule sets also provides fine-grained access and enforcement, including bypass permissions, commit requirements, and review restrictions.
258+
259+
##### Components of Rule Sets
260+
- Target: The branches or tags the rule set applies to. You can use wildcard patterns (e.g., main, release/*).
261+
- Commit Requirements:
262+
- Require signed commits.
263+
- Require linear history (no merge commits).
264+
- Restrict force pushes or deletions.
265+
- Pull Request Requirements:
266+
- Require a pull request before merging.
267+
- Require a certain number of approving reviews.
268+
- Dismiss stale pull request approvals.
269+
- Require status checks to pass before merging.
270+
- Bypass Permissions:
271+
- Grant specific roles or teams the ability to bypass some or all rules.
272+
- Enforcement: Rule sets can be configured as active or dry-run for testing without enforcement.
273+
274+
##### Use Cases:
275+
- Enforcing CI/CD quality gates.
276+
- Mandating code review practices.
277+
- Preventing accidental deletion or force-pushes.
278+
- Standardizing commit conventions across repositories.
279+
280+
##### How to Configure (UI/CLI/API):
281+
- UI: Go to your repository > Settings > Rules > Create Rule Set.
282+
- CLI (gh): Use GitHub CLI extensions or APIs.
283+
- API: [GitHub REST API V3](https://docs.github.com/en/rest/repos/rules)
284+
285+
### GitHub Actions
286+
GitHub Actions is a powerful CI/CD and automation framework built directly into GitHub.
287+
288+
##### Key Concepts:
289+
- Workflow: A YAML file that defines the automation process. Stored in .github/workflows/.
290+
- Job: A set of steps run on the same runner. Jobs can run in parallel or sequentially.
291+
- Step: A single task like running a command or action.
292+
- Runner: The execution environment (GitHub-hosted or self-hosted).
293+
- Action: A reusable component that can be called in workflows. Actions can be written in JavaScript or as Docker containers.
294+
295+
##### Core Features:
296+
- Event-driven: Trigger workflows on events like push, pull_request, schedule, or custom webhooks.
297+
- Matrix Builds: Run tests across multiple OS and language versions.
298+
- Caching & Artifacts: Speed up builds and preserve build output.
299+
- Environment Secrets: Securely inject API keys and credentials.
300+
- Job Dependencies: Define dependencies using needs.
301+
302+
##### Sample Workflow:
303+
304+
```sh
305+
name: CI Pipeline
306+
307+
on:
308+
push:
309+
branches: [ main ]
310+
pull_request:
311+
branches: [ main ]
312+
313+
jobs:
314+
build:
315+
runs-on: ubuntu-latest
316+
steps:
317+
- uses: actions/checkout@v3
318+
- name: Set up Node.js
319+
uses: actions/setup-node@v3
320+
with:
321+
node-version: '18'
322+
- run: npm install
323+
- run: npm test
324+
325+
```
326+
327+
##### Popular Use Cases:
328+
- Running tests and linters on pull requests.
329+
- Deploying applications to AWS/Azure/GCP.
330+
- Automating version bumps and releases.
331+
- Notifying Slack/Teams of deployments or failures.
332+
333+
##### Best Practices:
334+
- Use reusable workflows (.github/workflows/reusable.yml).
335+
- Store secrets in GitHub Secrets.
336+
- Use third-party verified Actions with caution.
337+
- Leverage caching for faster builds.
338+
- Avoid hardcoding credentials.
339+
340+
##### Summary:
341+
Combining Rule Sets and GitHub Actions enhances repo governance:
342+
- Rule Sets can enforce that certain Actions (e.g., tests) must pass before merges.
343+
- Required status checks can point to specific workflows.
344+
- You can enforce review requirements alongside automated quality gates.

0 commit comments

Comments
 (0)