diff --git a/.github/workflows/md-html-deploy.yml b/.github/workflows/md-html-deploy.yml index acf9b71a..53197e72 100644 --- a/.github/workflows/md-html-deploy.yml +++ b/.github/workflows/md-html-deploy.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - main + # push: # branches: # - main # Trigger the workflow on push to the main branch @@ -19,21 +20,30 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - # Step 2: Set up Node.js environment + # Step 2: Check for lock file + - name: Check for lock file + run: | + if [ -f .lock ]; then + echo "Another workflow is running. Exiting." + exit 1 + fi + touch .lock + + # Step 3: Set up Node.js environment - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: '14' # Specify the Node.js version - # Step 3: Install npm dependencies + # Step 4: Install npm dependencies - name: Install dependencies run: npm install - # Step 4: Install pandoc for Markdown to HTML conversion + # Step 5: Install pandoc for Markdown to HTML conversion - name: Install pandoc run: sudo apt-get install -y pandoc - # Step 5: Convert all Markdown files to HTML while preserving directory structure + # Step 6: Convert all Markdown files to HTML while preserving directory structure - name: Convert Markdown to HTML run: | mkdir -p _site # Create the _site directory if it doesn't exist @@ -45,29 +55,27 @@ jobs: pandoc "$file" --standalone --toc -o "_site/${file%.md}.html" done - # Step 6: Deploy the generated HTML files to GitHub Pages + # Step 7: Deploy the generated HTML files to GitHub Pages - name: Deploy to GitHub Pages + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Configure Git with a bot email and name git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - # Check for local changes and stash them if present - if [ -n "$(git status --porcelain)" ]; then - git stash - git pull origin ${{ github.ref }} --rebase - git stash pop || true # Ignore error if no stash entries to pop - else - git pull origin ${{ github.ref }} --rebase - fi - # Add all changes, including untracked files + # Ensure all changes are staged git add -A - # Check for changes before committing + # Commit changes if there are any if git diff-index --quiet HEAD --; then echo "No changes to commit" - exit 0 else - # Commit the changes git commit -m 'Deploy static HTML files' - # Push the changes to the remote branch - git push origin HEAD:${{ github.ref }} fi + # Push changes to the pull request branch + git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} + git push origin HEAD:${{ github.event.pull_request.head.ref }} || echo "Push failed due to conflicts" + + # Step 8: Remove lock file + - name: Remove lock file + if: always() + run: rm -f .lock diff --git a/.github/workflows/update-md-date.yml b/.github/workflows/update-md-date.yml index e44d2054..3d8d4ce1 100644 --- a/.github/workflows/update-md-date.yml +++ b/.github/workflows/update-md-date.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: pip install python-dateutil - - name: Configure Git + - name: Configure Git run: | git config --global user.email "belindabrownr04@gmail.com" git config --global user.name "brown9804" @@ -32,7 +32,12 @@ jobs: run: python .github/workflows/update_date.py - name: Commit changes + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + git fetch origin + git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed" git add -A git commit -m "Update last modified date in Markdown files" || echo "No changes to commit" + git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} git push origin HEAD:${{ github.event.pull_request.head.ref }} diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml new file mode 100644 index 00000000..399f29cf --- /dev/null +++ b/.github/workflows/use-visitor-counter.yml @@ -0,0 +1,93 @@ +name: Use Visitor Counter Logic + +on: + pull_request: + branches: + - main + schedule: + - cron: '0 0 * * *' # Runs daily at midnight + workflow_dispatch: # Allows manual triggering + +permissions: + contents: write + pull-requests: write + +jobs: + use-counter-logic: + runs-on: ubuntu-latest + + steps: + - name: Checkout current repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Clone github-visitor-counter repository temporarily + run: git clone https://github.com/brown9804/github-visitor-counter.git + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Install dependencies for github-visitor-counter + run: | + cd github-visitor-counter + npm install + + - name: Run visitor counter logic + run: | + cd github-visitor-counter + node update_repo_views_counter.js + env: + TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }} + REPO: ${{ github.repository }} + + - name: Move generated files to current repository + run: | + mv github-visitor-counter/metrics.json . + mv github-visitor-counter/README.md . + + - name: Clean up temporary files + run: rm -rf github-visitor-counter + + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Commit and push to PR branch + if: github.event_name == 'pull_request' + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git fetch origin + git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }} + git add README.md metrics.json + git commit -m "Update visitor count" || echo "No changes to commit" + git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} + git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed" + git push origin HEAD:${{ github.event.pull_request.head.ref }} + + - name: Commit and push to new branch (non-PR) + if: github.event_name != 'pull_request' + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git fetch origin + git checkout ${{ github.event.pull_request.head.ref }} || git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }} + git add README.md metrics.json + git commit -m "Update visitor count" || echo "No changes to commit" + git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} + git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed" + git push origin HEAD:${{ github.event.pull_request.head.ref }} + + - name: Create Pull Request (non-PR) + if: github.event_name != 'pull_request' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update-visitor-count + title: "Update visitor count" + body: "Automated update of visitor count" + base: main diff --git a/README.md b/README.md index 18102b53..d4d7eb0a 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,99 @@ -# Cloud DevOps:
Learning Path - Overview +# Open Source Visitor Counter Costa Rica +[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com) [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2024-12-13 +Last updated: 2025-07-10 ---------- -> Provides the essential knowledge required to work effectively within Azure and embrace DevOps/Agile methodologies. Additionally, it offers insights into fundamental cloud concepts. - -
-Table of Contents (Click to expand) - -- [Agile](https://github.com/brown9804/SDLC-Cloud_Lpath/tree/main/Agile) -- [DevOps](https://github.com/brown9804/SDLC-Cloud_Lpath/tree/main/DevOps) -- [Network](https://github.com/brown9804/SDLC-Cloud_Lpath/tree/main/Network) -- [GitHub](https://github.com/brown9804/CloudDevOps_LPath/tree/main/GitHub) -- [Cloud Principles](https://github.com/brown9804/SDLC-Cloud_Lpath/tree/main/Cloud) - - [0. Linux](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux) - - [Working with Users and Permissions](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab0) - - [System Service Management, Runlevels and Boot Targets](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab1) - - [Securely Accessing Your System](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab2) - - [Package Management and Troubleshooting](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab3) - - [File Management, Permissions and Backup](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab4) - - [Working with Text Files and Streams](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab5) - - [Linux Device Management](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab6) - - [The Linux Shell](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab7) - - [Networking](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab8) - - [Processes Management](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/0-linux/lab9) - - [1. Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform) - - [Installing Terraform and Working with Terraform Providers](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab0) - - [Using Terraform CLI Commands (workspace and state) to Manipulate a Terraform Deployment](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab1) - - [Building and Testing a Basic Terraform Module](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab2) - - [Exploring Terraform State Functionality](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab3) - - [Deploy an Azure Storage Account with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab4) - - [Deploy an Azure File Share and Blob Storage with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab5) - - [Deploy Azure VNETs and Subnets with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab6) - - [Create Azure NSGs with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab7) - - [Deploying an Azure VM with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab8) - - [Deploy a Web Application with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab9) - - [Deploy a MySQL Database with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_10) - - [Migrating Terraform State to Terraform Cloud](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_11) - - [Using Terraform Provisioners to Set Up an Apache Web Server on AWS](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_12) - - [Make Changes to AWS Infrastructure Using Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_13) - - [Use Output Variables to Query Data in AWS Using Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_14) - - [Make Changes to Azure Infrastructure Using Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_15) - - [Use Output Variables to Query Data in Azure Using Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_16) - - [Use Terraform to Create a Kubernetes Deployment](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_17) - - [Manage Kubernetes Resources with Terraform](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_18) - - [Use Terraform to Create an EKS Deployment](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_19) - - [Troubleshooting a Terraform Deployment](https://github.com/brown9804/DevOps-Agile-Cloud_path/tree/main/Cloud/1-terraform/lab_20) - - - [Automation Principles](https://github.com/brown9804/SDLC-Cloud_Lpath/tree/main/Cloud/2-automation_principles) - - [Kubernetes Principles](https://github.com/brown9804/SDLC-Cloud_Lpath/tree/main/Cloud/3-kubernetes_principles) - -
- -## Overview - -- SDLC - [What is and how it works](https://agilie.com/blog/what-is-the-software-development-life-cycle-sdlc-and-how-does-it-work) - -![image](https://github.com/brown9804/SDLC-Cloud_Lpath/assets/24630902/e809d790-87d4-41a1-b9ea-071327ab6ef2) - -![Benefits](https://github.com/brown9804/SDLC-Cloud_Lpath/assets/24630902/dc014629-a069-44f3-b657-7f8d39968272) - -![image](https://github.com/brown9804/SDLC-Cloud_Lpath/assets/24630902/a3b6522f-88c2-4ede-a477-09280f5584b9) - -- SDLC - [Methodologies](https://datarob.com/sdlc-methodologies/) - -![image](https://github.com/brown9804/SDLC-Cloud_Lpath/assets/24630902/5ba714af-4238-48d3-9043-cbcd64a590f1) - - +> This repository provides a customizable GitHub visitor counter that tracks and displays the number of visits to your GitHub profile or repository. The counter updates daily using the GitHub Traffic API and writes the total views directly into the README file. + +## Features + +- **Daily-updated visitor counting**: Fetches real visitor data from the GitHub Traffic API. +- **Markdown-based display**: Updates the README file with the total visitor count. +- **Open source and customizable**. + +## How it works + +> [!IMPORTANT] +> This counter is updated once per day (not real-time) and shows the total number of visits (including repeat visits) as reported by GitHub. + +- A GitHub Action workflow runs daily to fetch visitor data from the GitHub Traffic API. +- The action updates the `README.md` file with the total visitor count and the refresh timestamp. + +## How to use it + +1. **Add the Badge to Your Repository**: Include the following markdown in your `README.md` file, between the `START BADGE` and `END BADGE` (included), as shown in the bottom. +2. **Create a Personal Access Token**: + - Go to **GitHub Settings** > **Developer Settings** > **Personal Access Tokens**. + - Generate a new token with `repo` access. +3. **Save the Token as a Secret**: + - In your repository, navigate to **Settings** > **Secrets and Variables** > **Actions**. + - Add a new secret named `TRAFFIC_TOKEN` and paste the generated token. +4. **Add the Pipeline**: This single pipeline will fetch the visitor count, update the badge in the `README.md` file, and push the changes back to the repository. + - Create a GitHub Actions workflow (`update-metrics.yml`) in your repository to handle the visitor counter logic. + - Use the following content for the workflow: + + ```yaml + name: Update Visitor Counter + + on: + schedule: + - cron: '0 0 * * *' # Runs daily at midnight + workflow_dispatch: # Allows manual triggering + + jobs: + update-counter: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Install dependencies + run: npm install @brown9804/github-visitor-counter + + - name: Run visitor counter script + run: node node_modules/@brown9804/github-visitor-counter/update_repo_views_counter.js + env: + TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }} + REPO: ${{ github.repository }} + + - name: Commit and push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add README.md metrics.json + git commit -m "Update visitor count" + git push + ``` + +## Files structure + +- `README.md`: Contains instructions and displays the visitor count badge. +- `update_repo_views_counter.js`: Script to fetch visitor count data from the GitHub Traffic API and update the `README.md` file. +- `package.json`: Defines dependencies and scripts for the project. +- `LICENSE`: Specifies the license for the project. + +> [!IMPORTANT] +> +> - Replace `` and `` with your actual values. +> - Use a Personal Access Token (PAT) with `repo` access as `TRAFFIC_TOKEN` secret in each target repository. +> - The action will trigger the visitor counter logic in the main repository and update the badge dynamically. + +
-

Total Visitors

- Visitor Count + Total views +

Refresh Date: 2025-07-10

+ diff --git a/_site/DevOps/README.html b/_site/DevOps/README.html index 4b3fadf6..a83eacd1 100644 --- a/_site/DevOps/README.html +++ b/_site/DevOps/README.html @@ -170,8 +170,7 @@
  • DevOps Overview
      -
    • Wiki
    • -
    • Content
    • +
    • Overview
    • CAMS
    • Practices
    • Example
    • @@ -215,12 +214,13 @@

      DevOps Overview

      href="https://github.com/brown9804">brown9804

      Last updated: 2024-12-13


      +

      Has his roots in agile and iterative

      +

      Code + systems

      -

      Wiki

      -Table of Wiki (Click to expand) +List of References (Click to expand)
      -

      Content

      +

      Overview

      • Example diff --git a/_site/GitHub/README.html b/_site/GitHub/README.html index b9a46d11..5539bec9 100644 --- a/_site/GitHub/README.html +++ b/_site/GitHub/README.html @@ -170,7 +170,6 @@

      • GitHub Overview
          -
        • Wiki
        • How to Commit/Push to Github
        • @@ -187,10 +186,9 @@

          GitHub Overview

          href="https://github.com/brown9804">brown9804

          Last updated: 2024-12-13


          -

          Wiki

          -Table of Wiki (Click to expand) +List of References (Click to expand)
          • Prototyping with AI Models on GitHub
              -
            • Wiki
            • -
            • Content
            • Overview
            • Demo
                @@ -276,10 +274,9 @@

                Prototyping with AI Models This process involves several key steps and tools that facilitate the development and deployment of AI-powered applications.

                -

                Wiki

                -Table of Wiki (Click to expand) +List of References (Click to expand)
                -

                Content

                Table of Content (Click to expand)
                  -
                • Wiki
                • -
                • Content
                • Overview
                • Demo
                    diff --git a/_site/GitHub/demos/1_GitHubPagesOverview/README.html b/_site/GitHub/demos/1_GitHubPagesOverview/README.html new file mode 100644 index 00000000..7476283d --- /dev/null +++ b/_site/GitHub/demos/1_GitHubPagesOverview/README.html @@ -0,0 +1,324 @@ + + + + + + + README + + + + +

                    GitHub Pages -Overview

                    +

                    Costa Rica

                    +

                    brown9804

                    +

                    Last updated: 2025-01-13

                    +
                    +

                    GitHub Pages is a feature provided by GitHub that +allows you to +host static websites directly from a GitHub repository. +It’s a great way to showcase your projects, create personal websites, or +host documentation for your repositories.

                    +
                    +
                    + +List of References (Click to expand) + + +
                    +
                    + +Table of Content (Click to expand) + + +
                    +
                    +

                    What is GitHub Pages?
                    GitHub Pages is a +free service that turns your GitHub repositories into websites. +You can host HTML, CSS, and JavaScript files, and it’s perfect for +static websites that don’t require server-side processing. +GitHub Pages supports custom domains, making it easy to create a +professional-looking website.

                    +
                    +

                    How is GitHub Pages Used?

                    +
                      +
                    • Personal Websites: Showcase your portfolio, resume, +or blog.
                    • +
                    • Project Documentation: Host documentation for your +open-source projects.
                    • +
                    • Organization Sites: Create websites for +organizations or communities.
                    • +
                    • Demo Sites: Share live demos of your projects.
                    • +
                    +

                    Automate +the process of converting Markdown to static HTML and deploying it using +GitHub Pages and GitHub Actions

                    +
                      +
                    1. Create a GitHub Repository +
                        +
                      • Go to GitHub and create a new repository. Name it +username.github.io, where username is your +GitHub username.
                      • +
                      • Make sure the repository is public.
                      • +
                    2. +
                    3. Add Your Markdown Files +
                        +
                      • Clone the repository to your local machine.
                      • +
                      • Add your Markdown files to the repository.
                      • +
                      • Commit and push the changes to GitHub.
                      • +
                    4. +
                    5. Create a GitHub Actions Workflow +
                        +
                      • In your repository, create a .github/workflows +directory.
                      • +
                      • Inside this directory, create a file named +md-html-deploy.yml.
                      • +
                    6. +
                    7. Define the Workflow: Add the following content to the +md-html-deploy.yml file to set up a workflow that converts +Markdown to HTML and deploys it to the main branch: +
                        +
                      1. Checkout Repository: This step checks out your +repository so that the workflow can access the files.
                      2. +
                      3. Set up Node.js: This step sets up Node.js, which is +required for some Markdown converters.
                      4. +
                      5. Install Dependencies: This step installs the +necessary dependencies for your project.
                      6. +
                      7. Convert Markdown to HTML: This step uses +pandoc to convert Markdown files to HTML and places them in +the _site directory.
                      8. +
                      9. Deploy to GitHub Pages: This step commits the +generated HTML files back to the main branch and pushes the +changes. This ensures that your GitHub Pages site is updated with the +latest HTML files.
                      10. +
                      +
                      +

                      Click here +to see an example of the pipeline

                      +
                    8. +
                    +

                    Setting Up GitHub Pages

                    +
                      +
                    1. Create a Repository: Create a new repository on +GitHub or use an existing one.
                    2. +
                    3. Enable GitHub Pages: +
                        +
                      • Go to the repository settings on GitHub.

                      • +
                      • Under the GitHub Pages section, select the +main branch as the source.

                        +

                        image

                      • +
                      +
                      +

                      Static HTML refers to web pages that are delivered to the user’s +browser exactly as stored, without any server-side processing. Static +sites are fast, secure, and easy to deploy, making them ideal for simple +websites, portfolios, blogs, and documentation.

                      +
                    4. +
                    5. Push Your Code: Commit and push your code to the main branch. The +GitHub Actions workflow will automatically run and deploy your site to +GitHub Pages.
                    6. +
                    +
                    +

                    +Total Visitors +

                    +

                    Visitor Count

                    +
                    + + diff --git a/_site/README.html b/_site/README.html index bb9125ca..8d9aef0d 100644 --- a/_site/README.html +++ b/_site/README.html @@ -162,201 +162,218 @@ vertical-align: middle; } .display.math{display: block; text-align: center; margin: 0.5rem auto;} + /* CSS for syntax highlighting */ + pre > code.sourceCode { white-space: pre; position: relative; } + pre > code.sourceCode > span { line-height: 1.25; } + pre > code.sourceCode > span:empty { height: 1.2em; } + .sourceCode { overflow: visible; } + code.sourceCode > span { color: inherit; text-decoration: inherit; } + div.sourceCode { margin: 1em 0; } + pre.sourceCode { margin: 0; } + @media screen { + div.sourceCode { overflow: auto; } + } + @media print { + pre > code.sourceCode { white-space: pre-wrap; } + pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } + } + pre.numberSource code + { counter-reset: source-line 0; } + pre.numberSource code > span + { position: relative; left: -4em; counter-increment: source-line; } + pre.numberSource code > span > a:first-child::before + { content: counter(source-line); + position: relative; left: -1em; text-align: right; vertical-align: baseline; + border: none; display: inline-block; + -webkit-touch-callout: none; -webkit-user-select: none; + -khtml-user-select: none; -moz-user-select: none; + -ms-user-select: none; user-select: none; + padding: 0 4px; width: 4em; + color: #aaaaaa; + } + pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } + div.sourceCode + { } + @media screen { + pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } + } + code span.al { color: #ff0000; font-weight: bold; } /* Alert */ + code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ + code span.at { color: #7d9029; } /* Attribute */ + code span.bn { color: #40a070; } /* BaseN */ + code span.bu { color: #008000; } /* BuiltIn */ + code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ + code span.ch { color: #4070a0; } /* Char */ + code span.cn { color: #880000; } /* Constant */ + code span.co { color: #60a0b0; font-style: italic; } /* Comment */ + code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ + code span.do { color: #ba2121; font-style: italic; } /* Documentation */ + code span.dt { color: #902000; } /* DataType */ + code span.dv { color: #40a070; } /* DecVal */ + code span.er { color: #ff0000; font-weight: bold; } /* Error */ + code span.ex { } /* Extension */ + code span.fl { color: #40a070; } /* Float */ + code span.fu { color: #06287e; } /* Function */ + code span.im { color: #008000; font-weight: bold; } /* Import */ + code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ + code span.kw { color: #007020; font-weight: bold; } /* Keyword */ + code span.op { color: #666666; } /* Operator */ + code span.ot { color: #007020; } /* Other */ + code span.pp { color: #bc7a00; } /* Preprocessor */ + code span.sc { color: #4070a0; } /* SpecialChar */ + code span.ss { color: #bb6688; } /* SpecialString */ + code span.st { color: #4070a0; } /* String */ + code span.va { color: #19177c; } /* Variable */ + code span.vs { color: #4070a0; } /* VerbatimString */ + code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ -

                    Cloud DevOps - Learning Path

                    +

                    Open Source Visitor Counter

                    Costa Rica

                    -

                    GitHub brown9804

                    -

                    Last updated: 2024-12-13

                    +

                    Last updated: 2025-07-10


                    -

                    Provides the essential knowledge required to work effectively within -Azure and embrace DevOps/Agile methodologies. Additionally, it offers -insights into fundamental cloud concepts.

                    +

                    This repository provides a customizable GitHub visitor counter that +tracks and displays the number of visits to your GitHub profile or +repository. The counter updates daily using the GitHub Traffic API and +writes the total views directly into the README file.

                    -
                    -

                    -Total Visitors -

                    -

                    Visitor Count

                    -
                    -

                    Content

                    -
                    - -Table of Contents (Click to expand) - +

                    Features

                      -
                    • Agile
                    • -
                    • DevOps
                    • -
                    • Network
                    • -
                    • GitHub
                    • -
                    • Cloud -Principles +
                    • Daily-updated visitor counting: Fetches real +visitor data from the GitHub Traffic API.
                    • +
                    • Markdown-based display: Updates the README file +with the total visitor count.
                    • +
                    • Open source and customizable.
                    • +
                    +

                    How it works

                    +
                    +

                    [!IMPORTANT] This counter is updated once per day (not real-time) and +shows the total number of visits (including repeat visits) as reported +by GitHub.

                    +
                      -
                    • 0. -Linux +
                    • A GitHub Action workflow runs daily to fetch visitor data from the +GitHub Traffic API.
                    • +
                    • The action updates the README.md file with the total +visitor count and the refresh timestamp.
                    • +
                    +

                    How to use it

                    +
                      +
                    1. Add the Badge to Your Repository: Include the +following markdown in your README.md file, between the +START BADGE and END BADGE (included), as shown +in the bottom.
                    2. +
                    3. Create a Personal Access Token:
                    4. -
                    5. 1. -Terraform +
                    6. Save the Token as a Secret:
                    7. -
                    8. Automation -Principles
                    9. -
                    10. Kubernetes -Principles
                    11. +
                    12. In your repository, navigate to Settings > +Secrets and Variables > +Actions.
                    13. +
                    14. Add a new secret named TRAFFIC_TOKEN and paste the +generated token.
                • +
                • Add the Pipeline: This single pipeline will fetch +the visitor count, update the badge in the README.md file, +and push the changes back to the repository. +
                    +
                  • Create a GitHub Actions workflow (update-metrics.yml) +in your repository to handle the visitor counter logic.
                  • +
                  • Use the following content for the workflow:
                  -
                -

                Wiki

                +
                name: Update Visitor Counter
                +
                +on:
                +  schedule:
                +    - cron: '0 0 * * *' # Runs daily at midnight
                +  workflow_dispatch: # Allows manual triggering
                +
                +jobs:
                +  update-counter:
                +    runs-on: ubuntu-latest
                +
                +    steps:
                +      - name: Checkout repository
                +        uses: actions/checkout@v3
                +
                +      - name: Set up Node.js
                +        uses: actions/setup-node@v3
                +        with:
                +          node-version: '16'
                +
                +      - name: Install dependencies
                +        run: npm install @brown9804/github-visitor-counter
                +
                +      - name: Run visitor counter script
                +        run: node node_modules/@brown9804/github-visitor-counter/update_repo_views_counter.js
                +        env:
                +          TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
                +          REPO: ${{ github.repository }}
                +
                +      - name: Commit and push changes
                +        run: |
                +          git config --global user.name "github-actions[bot]"
                +          git config --global user.email "github-actions[bot]@users.noreply.github.com"
                +          git add README.md metrics.json
                +          git commit -m "Update visitor count"
                +          git push
                + +

                Files structure

                  -
                • SDLC - What -is and how it works
                • +
                • README.md: Contains instructions and displays the +visitor count badge.
                • +
                • update_repo_views_counter.js: Script to fetch visitor +count data from the GitHub Traffic API and update the +README.md file.
                • +
                • package.json: Defines dependencies and scripts for the +project.
                • +
                • LICENSE: Specifies the license for the project.
                -
                - - -
                -
                - - -
                -
                - - -
                +
                +

                [!IMPORTANT]

                  -
                • SDLC - Methodologies
                • +
                • Replace <main-repo-owner> and +<main-repo-name> with your actual values.
                • +
                • Use a Personal Access Token (PAT) with repo access as +TRAFFIC_TOKEN secret in each target repository.
                • +
                • The action will trigger the visitor counter logic in the main +repository and update the badge dynamically.
                -
                - - -
                +
                + +
                +Total views +

                +Refresh Date: 2025-07-10 +

                +
                + diff --git a/metrics.json b/metrics.json new file mode 100644 index 00000000..af88d5ec --- /dev/null +++ b/metrics.json @@ -0,0 +1,4 @@ +{ + "count": 195, + "lastUpdated": "2025-07-10T23:11:30.910Z" +} \ No newline at end of file