Skip to content

ez0000001000000/automation-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Actions Educational Workflows

EDUCATIONAL PURPOSES ONLY - DO NOT USE IN PRODUCTION

This repository contains a collection of GitHub Actions workflow examples designed for learning purposes. All workflows use manual triggers and placeholder values to ensure they cannot accidentally execute real actions.

⚠️ Safety Notice

  • All workflows use workflow_dispatch trigger only (manual execution)
  • All secrets use placeholder values (e.g., PLACEHOLDER_TOKEN)
  • Dangerous steps are commented out with continue-on-error: true
  • These workflows are for learning only, not for production use

Directory Structure

.github/
└── workflows/
    ├── ci/              # Continuous Integration workflows
    ├── quality/         # Code quality checks
    ├── deployment/      # Deployment automation
    ├── notifications/   # Communication workflows
    ├── api-testing/     # API testing workflows
    ├── scheduled/       # Scheduled task workflows
    ├── artifacts/       # Artifact management workflows
    └── environments/    # Environment-specific workflows
scripts/
├── bash/                # Bash scripts for automation
└── python/              # Python scripts for automation
notebooks/               # Jupyter notebooks for learning
examples/
├── config/              # Configuration file examples
└── data/                # Example data files
templates/               # Template files for workflows and scripts

Workflow Categories

1. CI Workflows (.github/workflows/ci/)

  • nodejs.yml - Node.js build, test, and lint pipeline
  • python.yml - Python testing with pytest and type checking
  • go.yml - Go module validation and testing
  • ruby.yml - Ruby bundle install and RSpec tests

Key Concepts Learned:

  • Matrix builds for multiple versions
  • Dependency caching
  • Setup actions for different languages
  • Running tests and linters

2. Quality Workflows (.github/workflows/quality/)

  • linting.yml - Code linting for JavaScript and Python
  • formatting.yml - Code formatting checks (Prettier, Black)
  • security.yml - Dependency audits and secret scanning
  • coverage.yml - Test coverage reporting

Key Concepts Learned:

  • Running multiple linters in parallel
  • Security vulnerability scanning
  • Coverage report generation
  • Code quality enforcement

3. Deployment Workflows (.github/workflows/deployment/)

  • github-pages.yml - Static site deployment to GitHub Pages
  • docker.yml - Docker image build and push
  • release.yml - Automated GitHub releases
  • docs.yml - Documentation generation and updates

Key Concepts Learned:

  • Building and pushing Docker images
  • Creating GitHub releases
  • Static site deployment
  • Documentation automation

4. Notification Workflows (.github/workflows/notifications/)

  • slack.yml - Slack webhook notifications
  • email.yml - Email notifications via SMTP
  • discord.yml - Discord webhook messages

Key Concepts Learned:

  • Webhook integrations
  • Secret management for API keys
  • Conditional notifications
  • Message formatting

5. API Testing Workflows (.github/workflows/api-testing/)

  • postman.yml - API testing with Postman/Newman
  • rest-assured.yml - API testing with Java/RestAssured

Key Concepts Learned:

  • Running API test collections
  • Generating test reports
  • Integration with testing frameworks
  • Automated API validation

6. Scheduled Task Workflows (.github/workflows/scheduled/)

  • daily-backup.yml - Scheduled daily backup tasks
  • weekly-report.yml - Scheduled weekly report generation

Key Concepts Learned:

  • Cron-based scheduling
  • Automated periodic tasks
  • Backup and reporting automation
  • Time-based workflow execution

7. Artifact Management Workflows (.github/workflows/artifacts/)

  • upload.yml - Build artifact upload
  • download.yml - Artifact download between jobs

Key Concepts Learned:

  • Artifact creation and storage
  • Cross-job artifact sharing
  • Build output management
  • Artifact retention policies

8. Environment Workflows (.github/workflows/environments/)

  • staging.yml - Staging environment deployment
  • production.yml - Production environment deployment with approval

Key Concepts Learned:

  • Environment-specific deployments
  • Deployment protection rules
  • Environment variables
  • Production approval workflows

Scripts Directory

Bash Scripts (scripts/bash/)

  • backup.sh - Backup automation script
  • deploy.sh - Deployment automation script
  • health-check.sh - Application health check script

Usage: These scripts can be called from GitHub Actions using the run step:

- name: Run backup
  run: ./scripts/bash/backup.sh

Python Scripts (scripts/python/)

  • generate_report.py - Report generation script
  • api_tester.py - API testing script
  • data_processor.py - Data processing script

Usage: These scripts can be called from GitHub Actions:

- name: Generate report
  run: python scripts/python/generate_report.py

Notebooks Directory

Jupyter Notebooks (notebooks/)

  • github-actions-basics.ipynb - Interactive introduction to GitHub Actions
  • workflow-examples.ipynb - Practical workflow examples

Usage: Open these notebooks in Jupyter to learn GitHub Actions concepts interactively.

Examples Directory

Configuration Files (examples/config/)

  • package.json - Example Node.js package configuration
  • requirements.txt - Example Python dependencies
  • Dockerfile - Example Docker configuration
  • docker-compose.yml - Example Docker Compose setup
  • .eslintrc.json - Example ESLint configuration
  • pyproject.toml - Example Python project configuration

Data Files (examples/data/)

  • sample_data.csv - Example CSV data for testing
  • test_data.json - Example JSON data for testing

Templates Directory

Template Files (templates/)

  • workflow_template.yml - Template for creating new workflows
  • script_template.sh - Template for bash scripts
  • script_template.py - Template for Python scripts

Usage: Copy these templates and modify them for your specific needs.

How to Use

  1. Explore the workflows: Browse the .github/workflows/ directory
  2. Read the comments: Each workflow includes educational comments
  3. Understand the structure: Note the YAML syntax and GitHub Actions syntax
  4. Learn the patterns: Identify common patterns across workflows
  5. Study the scripts: Review bash and Python scripts in scripts/ directory
  6. Use the notebooks: Open Jupyter notebooks for interactive learning
  7. Examine configurations: Check example configuration files in examples/config/
  8. Use templates: Copy and modify templates in templates/ for your projects

Common GitHub Actions Concepts

Triggers

on:
  workflow_dispatch:  # Manual trigger only
  # Other triggers (commented out for safety):
  # push:
  #   branches: [ main ]
  # pull_request:
  #   branches: [ main ]

Jobs and Steps

jobs:
  job-name:
    runs-on: ubuntu-latest
    steps:
      - name: Step description
        uses: action-name@version
        with:
          parameter: value

Secrets

env:
  API_KEY: ${{ secrets.PLACEHOLDER_TOKEN }}

Matrix Strategy

strategy:
  matrix:
    version: [1.0, 2.0, 3.0]

Cron Scheduling

on:
  schedule:
    - cron: '0 2 * * *'  # Runs daily at 2 AM UTC

Customizing for Your Use

To adapt these workflows for real use:

  1. Replace workflow_dispatch with appropriate triggers
  2. Replace placeholder secrets with actual secret names
  3. Uncomment and configure dangerous steps
  4. Adjust commands and paths for your project
  5. Add required dependencies and configuration files

Educational Resources

License

Educational use only. Modify and adapt as needed for learning purposes.


Remember: These workflows are designed for education. Always test thoroughly before using in production environments.