Update Form field has non-empty accessible name [e086e5]: Added secon… #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Copy-rules-to-WCAG | |
# Commit any change to the wcag-mapping.json file to the wcag repo as act-mapping.json | |
# | |
# Notes: | |
# - parameters can be set in the env section | |
# - the source filename needs to be set in two places below | |
# - in the on: trigger definition | |
# - in env | |
# - A Personal Access Token (PAT) stored as a secret is required for the push to work | |
# - Suggest this is set in a specific W3C account, rather a user account, so not accidently deleted | |
# - GitHub shows in the commit message a linkto the ACT repo commit | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- wcag-mapping.json | |
jobs: | |
copy-rules: | |
name: Copy rules | |
runs-on: ubuntu-latest | |
env: | |
SOURCE_FILENAME: wcag-mapping.json | |
DESTINATION_REPO: w3c/wcag | |
DESTINATION_BRANCH: main | |
DESTINATION_FILENAME: guidelines/act-mapping.json | |
COMMIT_MESSAGE: ACT rules update from https://github.com/${{ github.repository }}/commit/${{ github.sha }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
path: this | |
- name: Clone ${{ env.DESTINATION_REPO }} and copy ${{ env.SOURCE_FILENAME }} | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} # add as PAT (https://github.com/settings/tokens) as a secret | |
run: | | |
echo "Cloning $DESTINATION_REPO git repository" | |
git clone --single-branch --branch $DESTINATION_BRANCH "https://[email protected]/$DESTINATION_REPO.git" wcag | |
cp "this/$SOURCE_FILENAME" "wcag/$DESTINATION_FILENAME" | |
- name: Commit and push | |
run: | | |
echo "Commit" | |
cd wcag | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
# check for changes with git diff-index to stop error | |
git diff-index --quiet HEAD || git commit -m "$COMMIT_MESSAGE" | |
echo "Push" | |
git push origin --set-upstream "$DESTINATION_BRANCH" |