# ACT Rules

## Continuous Deployment

[Preview](https://wai-wcag-act-rules.netlify.app/)

[![Netlify Status](https://api.netlify.com/api/v1/badges/f053b1b3-85d4-4105-926b-9b30bebe83c0/deploy-status)](https://app.netlify.com/sites/wai-wcag-act-rules/deploys)

Useful links:
- [How to Create and Edit Documents](https://wai-website-theme.netlify.app/writing/)
- [Design Components](https://wai-website-theme.netlify.app/components/)
- [2021 redesign: open issues](https://github.com/w3c/wai-wcag-supporting-documents-redesign/issues/)

## Purpose

This repo receives Rules content and assets from the [ACT-Rules](https://github.com/act-rules/act-rules.github.io/) repository of the ACT-Rules Community Group, after processing done by the [ACT-Tools](https://github.com/act-rules/act-tools/) suite.

- Rules content and assets get pushed automatically on merge to the `develop` branch of the [ACT-Rules](https://github.com/act-rules/act-rules.github.io/) repository. If you have comments about the rules, [open a new issue on the ACT-Rules.github.io](https://www.github.com/act-rules/act-rules.github.io/issues/new/choose/).
- Setting a rule as "approved", or "proposed" is handled via GitHub actions on the [ACT-Rules](https://github.com/act-rules/act-rules.github.io/) repository.
- Implementation data is handled by additional scripts on the [ACT-Tools](https://github.com/act-rules/act-tools/).

## Build locally

Before you begin, make sure you have the following installed:

- [Ruby](https://www.ruby-lang.org/en/documentation/installation/) version 3.4.8 or higher\
    Check your Ruby version using `ruby -v`
- [Bundler](https://bundler.io/)

1. Install  Ruby dependencies

    ```bash
    bundle install
    ```

2. Use the latest version of the `wai-website-theme` and `wai-website-plugin` dependencies (optional)

    By default, the project will use the versions of the theme and plugin set in the `Gemfile.lock` file. To use the latest versions, run:
    
    ```bash
    bundle update wai-website-theme --conservative
    bundle update wai-website-plugin --conservative
    ```

    **Note:** Make sure to include the `--conservative` flag to avoid updating the gems the theme and plugin depend on.

3. Serve and preview

    ```bash
    bundle exec jekyll serve
    ```

## Set a rule to "approved"

1. On the ACT-rules CG repo, go to the [Set a rule to approved](https://github.com/act-rules/act-rules.github.io/actions/workflows/approve-rule.yml) GitHub Action.
2. Open "Run workflow", fill in the Rule ID, and optionally a branch name. When updating a rule that has been approved before, fill in a list of one or more changes from the previously approved rule version. 
3. Click "Run Workflow" and wait until it completes
4. Go to [w3c/wcag-act-rules Pull Requests](https://github.com/w3c/wcag-act-rules/pulls) and open a pull request from the branch that the GitHub action created.
    You can append multiple approved rules to the same PR by running the same action more than once with the chosen branch.

## Deprecating an approved rule

1. Remove the index.md file
2. Remove the rule from `rule-versions.yml`
3. Remove test cases from testcases.json (if any)
4. Set the rule to "proposed" in wcag-mapping.json

## Adding a new implementation

1. Refer to the ACT-Tools repository for instructions on how to [map a new implementation](https://github.com/act-rules/act-tools/#map-an-implementation) and [update existing implementations](https://github.com/act-rules/act-tools/#implementation-batch-update). 
2. In this repo, create a pull request with:
  - the implementation report generated by the scripts under [_data/wcag-act-rules/implementations/](https://github.com/w3c/wcag-act-rules/tree/main/_data/wcag-act-rules/implementations/),
  - updates to the [act-implementations.yml](https://github.com/w3c/wcag-act-rules/tree/main/_data/wcag-act-rules/act-implementations.yml) file,
  - a new page for the implementation details to show up on the WAI website under `content/implementations/`. 

  To avoid errors, copy an existing yml block and implementation page and replace the values with the ones for the new mapped implementation.
