text:
# Mizora
## By Mary E. Bradley Lane
### Published (1889)

  The full title is: *Mizora: A Prophecy: A Mss. Found Among the Private
  Papers of Princess Vera Zarovitch: Being a True and Faithful Account
  of her Journey to the Interior of the Earth, with a Careful
  Description of the Country and its Inhabitants, their Customs,
  Manners, and Government.* It was first serialized in the Cincinnati
  Commercial newspaper in 1880. Little is known about the author.

  Content warning: The society that the author describes is
  enthusiastically eugenicist.

Read [Mizora](https://lizadaly.github.io/utopia-novels/books/mizora-a-prophecy/mizora-a-prophecy.html) in a web browser.

Download an [EPUB ebook version](https://lizadaly.github.io/utopia-novels/books/mizora-a-prophecy/mizora-a-prophecy.epub).

## Book cover
<img src="https://lizadaly.github.io/utopia-novels/books/mizora-a-prophecy/cover.png" height="300" align="right">

Cover design by [Liza Daly](https://lizadaly.com)

repo_name: lizadaly/utopia-novels

repo_language: HTML

mime_type: text/plain


text:
# Awesome Humane Tech [![Awesome](https://awesome.re/badge.svg)](https://github.com/sindresorhus/awesome) [![Awesome Humane Tech](https://raw.githubusercontent.com/humanetech-community/awesome-humane-tech/main/humane-tech-badge.svg?sanitize=true)](https://github.com/humanetech-community/awesome-humane-tech)

[![Humane Tech Community](https://raw.githubusercontent.com/humanetech-community/awesome-humane-tech/main/humanetech-tech-distraction.jpg)](https://community.humanetech.com)

## About this list

Tech and social media is having a big impact on our society. While many innovative technology inventions are improving our lives, there is increasing awareness on negative impacts that come with these trends, such as large-scale privacy invasion, surveillance capitalism, and tech monopolies. They lead to social media addiction, mental health issues, and are even eroding the fabric of our society.

[![Humane Tech Community](https://raw.githubusercontent.com/humanetech-community/awesome-humane-tech/main/logo/humanetech-community-logo.svg?sanitize=true)](https://humanetech.community)

Our mission is: [**To Help Improve Wellbeing, Freedom and Society!**](https://community.humanetech.com/t/3322)

We gladly invite you to our [Humane Tech Community Forum](https://community.humanetech.com) to read more about interesting Humane Technology subjects, participate in our discussions, and become a true :heart:  _Humane Tech Activist!_

You can also follow us on the fediverse at [@humanetech@mastodon.social](https://mastodon.social/@humanetech).

# Give Up GitHub

This project has given up GitHub.  ([See Software Freedom Conservancy's *Give Up  GitHub* site for details](https://GiveUpGitHub.org).)

You can now find this project at [https://codeberg.org/teaserbot-labs/delightful-humane-design](https://codeberg.org/teaserbot-labs/delightful-humane-design) instead.

Any use of this project's code by GitHub Copilot, past or present, is done without our permission.  We do not consent to GitHub's use of this project's code in Copilot.

Join us; you can [give up GitHub](https://GiveUpGitHub.org) too!

![Logo of the GiveUpGitHub campaign](https://sfconservancy.org/img/GiveUpGitHub.png)


text:
# Super Tiny Icons

The logo's used in the list were obtained from [SuperTinyIcons](https://github.com/edent/SuperTinyIcons) by [Terence Eden](https://github.com/edent) and other contributors (thank you!). See the project for licensing info.


text:
# Welcome #

We're so glad you're thinking about contributing to this open source
project!  If you're unsure or afraid of anything, just ask or submit
the issue or pull request anyway.  The worst that can happen is that
you'll be politely asked to change something.  We appreciate any sort
of contribution, and don't want a wall of rules to get in the way of
that.

Before contributing, we encourage you to read our CONTRIBUTING policy
(you are here), our [LICENSE](LICENSE), and our [README](README.md),
all of which should be in this repository.

## Issues ##

If you want to report a bug or request a new feature, the most direct
method is to [create an
issue](https://github.com/cisagov/log4j-affected-db/issues) in this
repository.  We recommend that you first search through existing
issues (both open and closed) to check if your particular issue has
already been reported.  If it has then you might want to add a comment
to the existing issue.  If it hasn't then feel free to create a new
one.

## Pull requests ##

If you choose to [submit a pull
request](https://github.com/cisagov/log4j-affected-db/pulls), you will
notice that our continuous integration (CI) system runs a fairly
extensive set of linters and syntax checkers.  Your pull request may
fail these checks, and that's OK.  If you want you can stop there and
wait for us to make the necessary corrections to ensure your code
passes the CI checks.

If you want to make the changes yourself, or if you want to become a
regular contributor, then you will want to set up
[pre-commit](https://pre-commit.com/) on your local machine.  Once you
do that, the CI checks will run locally before you even write your
commit message.  This speeds up your development cycle considerably.

### Creating a pull request ###

Instructions for creating a pull request using the GitHub Web UI can be found
in [`PULL-EXAMPLE.md`](PULL-EXAMPLE.md).

### Setting up pre-commit ###

There are a few ways to do this, but we prefer to use
[`pyenv`](https://github.com/pyenv/pyenv) and
[`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) to
create and manage a Python virtual environment specific to this
project.

#### Installing and using `pyenv` and `pyenv-virtualenv` ####

On the Mac, we recommend installing [brew](https://brew.sh/).  Then
installation is as simple as `brew install pyenv pyenv-virtualenv` and
adding this to your profile:

```bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
```

For Linux, Windows Subsystem for Linux (WSL), or on the Mac (if you
don't want to use `brew`) you can use
[pyenv/pyenv-installer](https://github.com/pyenv/pyenv-installer) to
install the necessary tools. Before running this ensure that you have
installed the prerequisites for your platform according to the
[`pyenv` wiki
page](https://github.com/pyenv/pyenv/wiki/common-build-problems).

On WSL you should treat your platform as whatever Linux distribution
you've chosen to install.

Once you have installed `pyenv` you will need to add the following
lines to your `.bash_profile` (or `.profile`):

```bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
```

and then add the following lines to your `.bashrc`:

```bash
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
```

If you want more information about setting up `pyenv` once installed, please run

```console
pyenv init
```

and

```console
pyenv virtualenv-init
```

for the current configuration instructions.

If you are using a shell other than `bash` you should follow the
instructions that the `pyenv-installer` script outputs.

You will need to reload your shell for these changes to take effect so
you can begin to use `pyenv`.

For a list of Python versions that are already installed and ready to
use with `pyenv`, use the command `pyenv versions`.  To see a list of
the Python versions available to be installed and used with `pyenv`
use the command `pyenv install --list`.  You can read more
[here](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md) about
the many things that `pyenv` can do.  See
[here](https://github.com/pyenv/pyenv-virtualenv#usage) for the
additional capabilities that pyenv-virtualenv adds to the `pyenv`
command.

#### Creating the Python virtual environment ####

Once `pyenv` and `pyenv-virtualenv` are installed on your system, you
can create and configure the Python virtual environment with these
commands:

```console
cd log4j-affected-db
pyenv virtualenv <python_version_to_use> log4j-affected-db
pyenv local log4j-affected-db
pip install --upgrade pip setuptools wheel pre-commit
```

#### Installing the pre-commit hook ####

Now setting up pre-commit is as simple as:

```console
pre-commit install
```

At this point the pre-commit checks will run against any files that
you attempt to commit.  If you want to run the checks against the
entire repo, just execute `pre-commit run --all-files`.

## Public domain ##

This project is in the public domain within the United States, and
copyright and related rights in the work worldwide are waived through
the [CC0 1.0 Universal public domain
dedication](https://creativecommons.org/publicdomain/zero/1.0/).

All contributions to this project will be released under the CC0
dedication. By submitting a pull request, you are agreeing to comply
with this waiver of copyright interest.

repo_language: Shell


text:
# Pull Request Example #

Thank you for contributing to CISA's Log4j-affected-db GitHub Repository! Please
follow the steps listed below in order to add a product to the public
repository. **Note:** To assure the accuracy of data please only include
products that have official advisories or alerts that verify the product's
vulnerability status to  [CVE-2021-4104](https://nvd.nist.gov/vuln/detail/cve-2021-4104),
[CVE-2021-44228](https://nvd.nist.gov/vuln/detail/CVE-2021-44228),
[CVE-2021-45046](https://nvd.nist.gov/vuln/detail/CVE-2021-45046),
and/or [CVE-2021-45105](https://nvd.nist.gov/vuln/detail/CVE-2021-45105?s=09).

**Step 1:** Go to the [cisagov data .yml files](https://github.com/cisagov/log4j-affected-db/tree/develop/data/)
and choose the appropriate file to include your updates.
The files are separated alphabetically based on the first letter of the
vendor name. For example, 'CISA' would be located in
[`cisagov_C.yml`](https://github.com/cisagov/log4j-affected-db/blob/develop/data/cisagov_C.yml).

**Step 2:** Click the file edit button.

**Step 3:** Add the blank template to the **.yml** file for new entries and fill
it out with the correct data.

Blank template:

```yml
  - vendor: ''
    product: ''
    cves:
      cve-2021-4104:
        investigated: ''
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
      cve-2021-44228:
        investigated: ''
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
      cve-2021-45046:
        investigated: ''
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
      cve-2021-45105:
        investigated: ''
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
    vendor_links:
      - ''
    notes: ''
    references:
      - ''
    last_updated: ''
```

**Step 4:** Verify the new entry was entered before and/or after the prior and
next entries.

- If you are adding it to the beginning of the file, ensure you are pasting
it after `software:` and before the next entry starting with `- vendor:`.
- If you are adding it to the end of the file, ensure the entry ends before
the file is closed out with `...`.

**Step 5:** When you add content to the file, remove the `''` or `[]` for fields
which are replaced with values (strings `''` or lists `[]` should be replaced as
shown in the example below, with list values on the following line(s) starting
with hyphen(s) `-`). The symbols should only remain used when fields remain
empty. For example, `fixed_versions: []` in our example below remains as is,
given there are no patched versions available for this entry.

**Note:** not all fields have to be updated.

Entry example:

```yml
  - vendor: Example Vendor
    product: Example Product
    cves:
      cve-2021-4104:
        investigated: false
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
      cve-2021-44228:
        investigated: true
        affected_versions:
          - <=8.4.6
          - <=8.5.3
          - <=8.6.4
        fixed_versions: []
        unaffected_versions: []
      cve-2021-45046:
        investigated: ''
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
      cve-2021-45105:
        investigated: ''
        affected_versions: []
        fixed_versions: []
        unaffected_versions: []
    vendor_links:
      - https://www.example.org/
    notes: Contains vulnerable code but not likely to get
      unauthenticated user input to the log4j component.
    references:
      - ''
    last_updated: '2021-12-14T00:00:00'
```

**Step 6:** Validate that your data follows the appropriate format and proceed
with submitting the pull request.

For any additional questions feel free to [submit an Issue](https://github.com/cisagov/log4j-affected-db/issues).


text:
# CISA Log4j (CVE-2021-44228) Vulnerability Guidance #

This repository provides
[CISA's guidance](https://www.cisa.gov/uscert/apache-log4j-vulnerability-guidance)
and an overview of related software regarding the Log4j vulnerability
(CVE-2021-44228). CISA urges users and administrators to upgrade to Log4j 2.17.1
(Java 8), 2.12.4 (Java 7) and 2.3.2 (Java 6), and review and monitor the
[Apache Log4j Security Vulnerabilities webpage](https://logging.apache.org/log4j/2.x/security.html)
for updates and mitigation guidance.

The information in this repository is provided "as is" for informational
purposes only and is being assembled and updated by CISA through
collaboration with the broader cybersecurity community.  Inquire with the
manufacturer or their respective online resources for the most up-to-date
information regarding any specific product listed. CISA does not endorse
any commercial product or service, including any subjects of analysis.
Any reference to specific commercial products, processes, or services by
service mark, trademark, manufacturer, or otherwise, does not constitute
or imply their endorsement, recommendation, or favoring by CISA.

## Official CISA Guidance & Resources ##

- [CISA Apache Log4j Vulnerability Guidance](https://www.cisa.gov/uscert/apache-log4j-vulnerability-guidance)
- [CISA ED 22-02: Apache Log4j Recommended Mitigation Measures](https://www.cisa.gov/uscert/ed-22-02-apache-log4j-recommended-mitigation-measures)
- [CISA ALERT (AA21-356A): Mitigating Log4Shell and Other Log4j-Related Vulnerabilities](https://www.cisa.gov/uscert/ncas/alerts/aa21-356a)
- [Emergency Directive 22-02 Mitigate Apache Log4j Vulnerability](https://www.cisa.gov/emergency-directive-22-02)
- [Statement from CISA Director Easterly on “Log4j” Vulnerability](https://www.cisa.gov/news/2021/12/11/statement-cisa-director-easterly-log4j-vulnerability).

## CISA Current Activity Alerts ##

- [Mitigating Log4Shell and Other Log4j-Related Vulnerabilities](https://www.cisa.gov/uscert/ncas/current-activity/2021/12/22/mitigating-log4shell-and-other-log4j-related-vulnerabilities)
- [CISA Issues ED 22-02 Directing Federal Agencies to Mitigate Apache Log4j Vulnerabilities](https://www.cisa.gov/uscert/ncas/current-activity/2021/12/17/cisa-issues-ed-22-02-directing-federal-agencies-mitigate-apache)
- [Apache Releases Log4j Version 2.15.0 to Address Critical RCE Vulnerability Under Exploitation](https://www.cisa.gov/uscert/ncas/current-activity/2021/12/10/apache-releases-log4j-version-2150-address-critical-rce)
- [CISA Creates Webpage for Apache Log4j Vulnerability CVE-2021-44228](https://www.cisa.gov/uscert/ncas/current-activity/2021/12/13/cisa-creates-webpage-apache-log4j-vulnerability-cve-2021-44228)

National Vulnerability Database (NVD) Information: [CVE-2021-44228](https://nvd.nist.gov/vuln/detail/CVE-2021-44228)

## CISA Mitigation Guidance ##

When updates are available, agencies must update software
using Log4j to the newest version, which is the most
effective and manageable long-term option. Where
updating is not possible, the following mitigating
measures can be considered as a temporary solution
and apply to the entire solution stack.

- **Disable Log4j library.** Disabling software using the
Log4j library is an effective measure, favoring
controlled downtime over adversary-caused issues.
This option could cause operational impacts and limit
visibility into other issues.
- **Disable JNDI lookups or disable remote codebases.**
This option, while effective, may involve
developer work and could impact functionality.
- **Disconnect affected stacks.** Solution stacks not
connected to agency networks pose a dramatically
lower risk from attack. Consider temporarily
disconnecting the stack from agency networks.
- **Isolate the system.** Create a “vulnerable network”
VLAN and segment the solution stack from the
rest of the enterprise network.
- **Deploy a properly configured Web Application
Firewall (WAF) in front of the solution stack.**
Deploying a WAF is an important, but incomplete,
solution. While threat actors will be able to
bypass this mitigation, the reduction in alerting
will allow an agency SOC to focus on a smaller
set of alerts.
- **Apply micropatch.** There are several micropatches
available. They are not a part of the official
update but may limit agency risk.
- Report incidents promptly to CISA and/or the FBI
[here](https://www.cisa.gov/uscert/report).

For more information regarding CISA recommended mitigation measures please visit
[here](https://www.cisa.gov/uscert/ed-22-02-apache-log4j-recommended-mitigation-measures).

## Contributing ##

We welcome contributions!  Please see [`CONTRIBUTING.md`](CONTRIBUTING.md) for
details.

### Creating a pull request ###

Instructions for creating a pull request using the GitHub Web UI can be found
in [`PULL-EXAMPLE.md`](PULL-EXAMPLE.md).

## Software List ##

To view the full list of vendors & software [click here](./software_lists/README.md).


text:
---
lineage:
  skeleton:
    remote-url: https://github.com/cisagov/skeleton-generic.git
version: '1'


text:
---
# Rather than breaking up descriptions into multiline strings we disable that
# specific rule in yamllint for this file.
# yamllint disable rule:line-length
- color: "eb6420"
  description: This issue or pull request is awaiting the outcome of another issue or pull request
  name: blocked
- color: "000000"
  description: This issue or pull request involves changes to existing functionality
  name: breaking change
- color: "d73a4a"
  description: This issue or pull request addresses broken functionality
  name: bug
- color: "07648d"
  description: This issue will be advertised on code.gov's Open Tasks page (https://code.gov/open-tasks)
  name: code.gov
- color: "0366d6"
  description: Pull requests that update a dependency file
  name: dependencies
- color: "5319e7"
  description: This issue or pull request improves or adds to documentation
  name: documentation
- color: "cfd3d7"
  description: This issue or pull request already exists or is covered in another issue or pull request
  name: duplicate
- color: "b005bc"
  description: A high-level objective issue encompassing multiple issues instead of a specific unit of work
  name: epic
- color: "000000"
  description: Pull requests that update GitHub Actions code
  name: github-actions
- color: "0e8a16"
  description: This issue or pull request is well-defined and good for newcomers
  name: good first issue
- color: "ff7518"
  description: Pull request that should count toward Hacktoberfest participation
  name: hacktoberfest-accepted
- color: "a2eeef"
  description: This issue or pull request will add or improve functionality, maintainability, or ease of use
  name: improvement
- color: "fef2c0"
  description: This issue or pull request is not applicable, incorrect, or obsolete
  name: invalid
- color: "ce099a"
  description: This pull request is ready to merge during the next Lineage Kraken release
  name: kraken 🐙
- color: "a4fc5d"
  description: This issue or pull request requires further information
  name: need info
- color: "fcdb45"
  description: This pull request is awaiting an action or decision to move forward
  name: on hold
- color: "ef476c"
  description: This issue is a request for information or needs discussion
  name: question
- color: "00008b"
  description: This issue or pull request adds or otherwise modifies test code
  name: test
- color: "1d76db"
  description: This issue or pull request pulls in upstream updates
  name: upstream update
- color: "d4c5f9"
  description: This issue or pull request increments the version number
  name: version bump
- color: "ffffff"
  description: This issue will not be incorporated
  name: wontfix


text:
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the
# repo. Unless a later match takes precedence, these owners will be
# requested for review when someone opens a pull request.
* @iainDe @justmurphy @Lcerkov

# These folks own the automated list update configuration.
/config/ @mcdonnnj

# These folks own any dot-files in the repository.
.* @dav3r @felddy @jsf9k @mcdonnnj

# These folks own any files in the .github directory at the root of
# the repository and any of its subdirectories.
/.github/ @dav3r @felddy @jsf9k @mcdonnnj


text:
---

# Any ignore directives should be uncommented in downstream projects to disable
# Dependabot updates for the given dependency. Downstream projects will get
# these updates when the pull request(s) in the appropriate skeleton are merged
# and Lineage processes these changes.

version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    ignore:
      # Managed by cisagov/skeleton-generic
      - dependency-name: actions/cache
      - dependency-name: actions/checkout
      - dependency-name: actions/setup-go
      - dependency-name: actions/setup-python
      - dependency-name: hashicorp/setup-terraform
      - dependency-name: mxschmitt/action-tmate

  - package-ecosystem: "pip"
    directory: "/"
    schedule:
      interval: "weekly"

  - package-ecosystem: "terraform"
    directory: "/"
    schedule:
      interval: "weekly"


text:
---
name: Update a Product
description: Update information about a product in the database
title: "[Product Update]: <vendor> - <product>"
body:
  - type: input
    id: product-vendor
    attributes:
      label: Product vendor
      description: Who is the vendor for the product?
      placeholder: Cisco, Dell, IBM, etc.
    validations:
      required: true
  - type: input
    id: product-name
    attributes:
      label: Product name
      description: What is the name of the product?
      placeholder: AppDynamics, BigFix Inventory, Centera, etc.
    validations:
      required: true
  - type: textarea
    id: update-context
    attributes:
      label: Context
      description: Please provide context around the update.
  - type: input
    id: product-versions
    attributes:
      label: Product version(s)
      description: What version(s) of the product are affected?
  - type: dropdown
    id: product-updated
    attributes:
      label: Product update
      description: Is there an update available for the product?
      options:
        - Available
        - Not Available
  - type: input
    id: product-update-link
    attributes:
      label: Product update link
      description: Where can the update be found, if one is available?
  - type: input
    id: product-last-updated
    attributes:
      label: Last updated
      description: When was the product last updated?
      placeholder: "2021-12-06"
  - type: textarea
    id: product-notes
    attributes:
      label: Notes
  - type: textarea
    id: product-references
    attributes:
      label: References


text:
---
name: Submit a Product
description: Submit a product to the database
title: "[Product Submission]: <vendor> - <product>"
body:
  - type: input
    id: product-vendor
    attributes:
      label: Product vendor
      description: Who is the vendor for the product?
      placeholder: Cisco, Dell, IBM, etc.
    validations:
      required: true
  - type: input
    id: product-name
    attributes:
      label: Product name
      description: What is the name of the product?
      placeholder: AppDynamics, BigFix Inventory, Centera, etc.
    validations:
      required: true
  - type: input
    id: product-versions
    attributes:
      label: Product version(s)
      description: What version(s) of the product is (are) affected?
      placeholder: v2; 1.5; >3; >=4; >5, <6; etc.
    validations:
      required: true
  - type: dropdown
    id: product-updated
    attributes:
      label: Product update
      description: Is there an update available for the product?
      options:
        - Available
        - Not Available
    validations:
      required: true
  - type: input
    id: product-update-link
    attributes:
      label: Product update link
      description: Where can the update be found, if one is available?
  - type: input
    id: product-last-updated
    attributes:
      label: Last updated
      description: When was the product last updated?
      placeholder: "2021-12-06"
  - type: textarea
    id: product-notes
    attributes:
      label: Notes
  - type: textarea
    id: product-references
    attributes:
      label: References


text:
---
name: build

on:
  push:
  pull_request:
  repository_dispatch:
    types: [apb]

env:
  PIP_CACHE_DIR: ~/.cache/pip
  PRE_COMMIT_CACHE_DIR: ~/.cache/pre-commit

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - id: setup-env
        uses: cisagov/setup-env-github-action@develop
      - uses: actions/checkout@v3
      - id: setup-python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"
      # We need the Go version and Go cache location for the actions/cache step,
      # so the Go installation must happen before that.
      - id: setup-go
        uses: actions/setup-go@v3
        with:
          go-version: "1.19"
      - name: Lookup Go cache directory
        id: go-cache
        run: |
          echo "dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
      - uses: actions/cache@v3
        env:
          BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
            py${{ steps.setup-python.outputs.python-version }}-\
            go${{ steps.setup-go.outputs.go-version }}-"
        with:
          path: |
            ${{ env.PIP_CACHE_DIR }}
            ${{ env.PRE_COMMIT_CACHE_DIR }}
            ${{ steps.go-cache.outputs.dir }}
          key: "${{ env.BASE_CACHE_KEY }}\
            ${{ hashFiles('**/.pre-commit-config.yaml') }}"
          restore-keys: |
            ${{ env.BASE_CACHE_KEY }}
      - name: Install shfmt
        env:
          PACKAGE_URL: mvdan.cc/sh/v3/cmd/shfmt
          PACKAGE_VERSION: ${{ steps.setup-env.outputs.shfmt-version }}
        run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip setuptools wheel
          pip install --upgrade pre-commit
      - name: Set up pre-commit hook environments
        run: pre-commit install-hooks
      - name: Run pre-commit on all files
        run: pre-commit run --all-files


text:
---
name: sync-labels

on:
  push:
    paths:
      - '.github/labels.yml'
      - '.github/workflows/sync-labels.yml'

permissions:
  contents: read

jobs:
  labeler:
    permissions:
      # actions/checkout needs this to fetch code
      contents: read
      # crazy-max/ghaction-github-labeler needs this to manage repository labels
      issues: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Sync repository labels
        if: success()
        uses: crazy-max/ghaction-github-labeler@v4
        with:
          # This is a hideous ternary equivalent so we only do a dry run unless
          # this workflow is triggered by the develop branch.
          dry-run: ${{ github.ref_name == 'develop' && 'false' || 'true' }}


text:
---
name: Update the software lists

on:
  push:
    branches:
      - develop

env:
  PIP_CACHE_DIR: ~/.cache/pip
  TESTING_BRANCH_BASE: testing/update_software_lists

jobs:
  setup:
    runs-on: ubuntu-latest
    outputs:
      # Commit author information for git
      git_author: ${{ steps.git-config.outputs.author }}
      git_email: ${{ steps.git-config.outputs.email }}
      git_user: ${{ steps.git-config.outputs.user }}
      # The name of the branch used for testing
      testing_branch: ${{ steps.testing-branch.outputs.name }}
    steps:
      - id: git-config
        run: |
          echo "::set-output name=author::$GIT_USER <$GIT_EMAIL>"
          echo "::set-output name=email::$GIT_EMAIL"
          echo "::set-output name=user::$GIT_USER"
        env:
          GIT_EMAIL: ${{ fromJson(secrets.GIT_AUTHOR_INFORMATION).user.email }}
          GIT_USER: ${{ fromJson(secrets.GIT_AUTHOR_INFORMATION).user.name }}
      - id: testing-branch
        run: echo "::set-output name=name::$BASE_BRANCH/$COMMIT_SHA"
        env:
          BASE_BRANCH: ${{ env.TESTING_BRANCH_BASE }}
          COMMIT_SHA: ${{ github.sha }}
  generate_updates:
    runs-on: ubuntu-latest
    needs: setup
    outputs:
      # If changes are detected then a commit will have been pushed
      has_updates: ${{ steps.commit-for-testing.outputs.changes_detected }}
    # Don't run if we're seeing an update push
    if: github.actor != needs.setup.outputs.git_user
    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.CISAGOVBOT_PAT }}
      - id: setup-python
        uses: actions/setup-python@v3
        with:
          python-version: "3.10"
      - uses: actions/cache@v3
        env:
          BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
            py${{ steps.setup-python.outputs.python-version }}-"
        with:
          path: |
            ${{ env.PIP_CACHE_DIR }}
          key: "${{ env.BASE_CACHE_KEY }}\
            ${{ hashFiles('.github/workflows/update_software_lists.yml') }}-\
            ${{ hashFiles('config/requirements.txt') }}"
          restore-keys: |
            ${{ env.BASE_CACHE_KEY }}
      - name: Update Python base packages
        run: python -m pip install --upgrade pip setuptools wheel
      - name: Install dependencies
        run: pip install --upgrade --requirement config/requirements.txt
      - name: Create the branch for test validation
        run: git switch --create ${{ needs.setup.outputs.testing_branch }}
      - name: Update the YAML and Markdown files as appropriate
        run: config/update_software_lists.sh
      - id: commit-for-testing
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          branch: ${{ needs.setup.outputs.testing_branch }}
          commit_message: Normalize YAML files and update the software lists
          commit_user_name: ${{ needs.setup.outputs.git_user }}
          commit_user_email: ${{ needs.setup.outputs.git_email }}
          commit_author: ${{ needs.setup.outputs.git_author }}
          file_pattern: data/cisagov*.yml software_lists/software_list_*.md
  merge_updates:
    runs-on: ubuntu-latest
    needs:
      - setup
      - generate_updates
    if: needs.generate_updates.outputs.has_updates == 'true'
    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.CISAGOVBOT_PAT }}
      - name: Configure git
        run: |
          git config user.name "${{ needs.setup.outputs.git_user }}"
          git config user.email "${{ needs.setup.outputs.git_email }}"
      - uses: lewagon/wait-on-check-action@v1.2.0
        with:
          check-name: lint
          ref: ${{ needs.setup.outputs.testing_branch }}
          repo-token: ${{ github.token }}
      - name: Merge the testing branch
        run: |
          git fetch
          git merge origin/${{ needs.setup.outputs.testing_branch }}
          git push
      - name: Cleanup testing branch
        run: git push --delete origin ${{ needs.setup.outputs.testing_branch }}