Skip to content

Commit

Permalink
feat: initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
isner committed Sep 6, 2023
0 parents commit 63ca36e
Show file tree
Hide file tree
Showing 13 changed files with 11,683 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
- workflow_dispatch

jobs:
main:
runs-on: ubuntu-latest
env:
# For testing purposes, publish to this repository
TARGET_REPO_NAME: dequelabs/action-vpat-publish
steps:
- uses: actions/checkout@v3

- run: echo "content=$(cat test/vpat.html)" >> $GITHUB_ENV

- name: Test publish action
uses: ./
with:
target-repo: ${{ env.TARGET_REPO_NAME }}
target-repo-github-token: ${{ secrets.GITHUB_TOKEN }}
target-repo-base-branch: main
target-repo-vpat-directory: vpats
product-id: test
vpat-content: ${{ env.content }}

- name: Test publish action again to simulate updating an existing PR
uses: ./
with:
target-repo: ${{ env.TARGET_REPO_NAME }}
target-repo-github-token: ${{ secrets.GITHUB_TOKEN }}
target-repo-base-branch: main
target-repo-vpat-directory: vpats
product-id: test
vpat-content: ${{ env.content }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/.DS_Store
node_modules/
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn build
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# action-vpat-publish

*GitHub Action that publishes a VPAT report to a target repository*

## Example workflow

```yaml
on:
push:
branches:
- main
paths:
- 'vpats/*'

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout my product repo
uses: actions/checkout@v3

- name: Convert most recent VPAT to HTML
uses: dequelabs/action-vpat-to-html@main
id: convert
with:
product-name: 'My Product'
vpat-location: vpats

- name: Publish VPAT to target repository
uses: dequelabs/action-vpat-publish@main
with:
target-repo-github-token: ${{ secrets.VPAT_PUBLISH_REPO_GITHUB_TOKEN }}
target-repo: <org-name>/<repo-name>
product-id: my-product
vpat-content: ${{ steps.convert.outputs.stringified-html }}
```
## Inputs
| Name | Description | Default |
| --- | --- | --- |
`target-repo-base-branch` | The base branch of the target repository. | `main` |
`target-repo-github-token` | GitHub token to access the target repository. |
`target-repo` | The GitHub repository to which the VPAT should be published. |
`target-repo-vpat-directory` | Directory where the VPAT should be published in the target repository. | `static/vpats`
`product-id` | Brief token that identifies your product. If publishing to the docs site, this should match the product ID used there. |
`vpat-content` | The VPAT content to publish. |

## Developer notes

* The compiled `dist/` directory is committed to the `main` branch by running `yarn build` locally and committing the changes. The pre-commit hook should do this for you.

## Testing

To test your changes, push a commit to the remote repository and manually trigger the `Test` workflow on the desired branch using the workflow dispatch feature in the GitHub web interface.

After the workflow has run, verify that the workflow successfully created a pull request called "Update VPAT for test" in this repository. Next, verify that the contents of the pull request are as expected - i.e., the test VPAT content added to `vpats/test.html`.

After verifying the test results, close the pull request (do not merge). This ensures that future tests will not be affected by the test VPAT content.
27 changes: 27 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish VPAT
description: Publish a VPAT to a target repository
author: Deque Systems, Inc.

inputs:
target-repo-base-branch:
description: The base branch of the target repository
default: main
target-repo-github-token:
description: GitHub token to access the target repository
required: true
target-repo:
description: The target GitHub repository
required: true
target-repo-vpat-directory:
description: Directory where the VPAT should be published in the target repository
default: static/vpats
product-id:
description: Brief token that identifies your product - should match product id in docs site
required: true
vpat-content:
description: The VPAT content as a string of HTML without escape characters
required: true

runs:
using: "node16"
main: "dist/index.js"
Loading

0 comments on commit 63ca36e

Please sign in to comment.