name: CI

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  test:
    name: Python ${{ matrix.python }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        python:
          - '3.6'
          - '3.7'
          - '3.8'
          - '3.9'
          - '3.10'
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest

    steps:
      - name: Clone repository
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python }}
          cache: pip

      - name: Print versions
        run: |
          python --version
          pip --version

      - name: Install Python dependencies
        run: pip install -r requirements.txt

      - name: Run lint
        run: flake8

      - name: Run makeHosts.py
        run: python makeHosts.py

      - name: Run tests
        run: python testUpdateHostsFile.py

name: CI

on:
  push:
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  test:
    name: Python ${{ matrix.python }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        python:
          - '3.6'
          - '3.7'
          - '3.8'
          - '3.9'
          - '3.10'
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest

    steps:
      - name: Clone repository
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python }}
          cache: pip

      - name: Print versions
        run: |
          python --version
          pip --version

      - name: Install Python dependencies
        run: pip install -r requirements.txt

      - name: Run lint
        run: flake8

      - name: Run makeHosts.py
        run: python makeHosts.py

      - name: Run tests
        run: python testUpdateHostsFile.py

Set permissions for GitHub actions
Set permissions for GitHub actions

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

 Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

Signed-off-by: naveensrinivasan <3ee6d032cf0e2168c09d055a780f32b07cd47cf5@users.noreply.github.com>
