generated from w3c/wai-resource-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
APG
to WAI
pipeline workflows to handle desync issues and …
…better reports on errors (#361) * Fix #219 * Update 'deploy.yml' to use 'w3cgruntbot' as committer * Update 'pr-create.yml' to force a rebase to happen with main in the case generated branch doesn't have relevant changes; additional error handling coverage with 'create-pr' script * For consistency, rename 'create-pr' script to 'pr-create' * Remove unnecessary delete branch action
- Loading branch information
Showing
9 changed files
with
508 additions
and
514 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,9 +36,12 @@ jobs: | |
node ./scripts/pre-build | ||
- name: Commit changed files and submodule updates | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: Commit changes | ||
commit_user_name: w3cgruntbot | ||
commit_user_email: [email protected] | ||
commit_author: w3cgruntbot <[email protected]> | ||
commit_message: "chore: Update `main` with latest changes from `aria-practices`" | ||
branch: main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,16 @@ on: | |
required: false | ||
|
||
jobs: | ||
create-pr: | ||
pr-create: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Get current job and log url | ||
uses: Tiryoh/gha-jobid-action@v0 | ||
uses: Tiryoh/gha-jobid-action@v1 | ||
id: jobs | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
job_name: create-pr | ||
job_name: pr-create | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
|
@@ -45,26 +45,30 @@ jobs: | |
ruby-version: 3.3 | ||
|
||
- name: Update git submodules | ||
if: github.event.inputs.fork_path == 'false' | ||
run: | | ||
git submodule update --recursive --remote | ||
cd _external/aria-practices | ||
if [ -n "${{ github.event.inputs.fork_path }}" ] && [ "${{ github.event.inputs.fork_path }}" != 'false' ]; then | ||
echo "Found fork: ${{ github.event.inputs.fork_path }}" | ||
git remote add fork https://github.com/${{ github.event.inputs.fork_path }}.git | ||
git fetch fork | ||
fi | ||
git checkout ${{ github.event.inputs.apg_sha }} | ||
- name: Update git submodules from fork | ||
if: github.event.inputs.fork_path != 'false' | ||
run: | | ||
git submodule update --recursive --remote | ||
cd _external/aria-practices | ||
git remote add fork https://github.com/${{ github.event.inputs.fork_path }}.git | ||
git fetch fork | ||
git checkout ${{ github.event.inputs.apg_sha }} | ||
- name: Switch to and create/update branch | ||
- name: Switch to and create or update branch | ||
run: | | ||
# switch to branch if exists or create branch | ||
git switch apg/${{ github.event.inputs.apg_branch }} 2>/dev/null || git switch -c apg/${{ github.event.inputs.apg_branch }} | ||
- name: Force rebase the switched branch onto main | ||
run: | | ||
git config --global user.name "w3cgruntbot" | ||
git config --global user.email "[email protected]" | ||
git fetch origin main | ||
git rebase --force-rebase origin/main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update site files | ||
id: update_site_files | ||
working-directory: ./ | ||
|
@@ -76,19 +80,23 @@ jobs: | |
|
||
- name: Commit changed files and submodule updates | ||
if: steps.update_site_files.outcome == 'success' | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: Commit changed files and submodule updates | ||
commit_user_name: w3cgruntbot | ||
commit_user_email: [email protected] | ||
commit_author: w3cgruntbot <[email protected]> | ||
commit_message: "chore: Update branch with latest `${{ github.event.inputs.apg_branch }}` changes and submodule updates" | ||
branch: apg/${{ github.event.inputs.apg_branch }} | ||
push_options: '--force' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create pull request | ||
- name: Create or update pull request | ||
working-directory: ./ | ||
run: | | ||
npm install -C scripts/create-pr | ||
node ./scripts/create-pr | ||
set -e | ||
npm install -C scripts/pr-create | ||
node ./scripts/pr-create | ||
env: | ||
GH_TOKEN: ${{ secrets.W3CGRUNTBOT_TOKEN }} | ||
APG_SHA: ${{ github.event.inputs.apg_sha }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,17 +12,24 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check if branch exists | ||
id: check_if_exists | ||
run: | | ||
OUTPUT=$(git ls-remote --heads https://github.com/${{ github.repository_owner }}/wai-aria-practices.git apg/${{ github.event.inputs.apg_branch }} | wc -l) | ||
echo "::set-output name=branch-exists::$(echo $OUTPUT)" | ||
BRANCH_EXISTS=$(git ls-remote --heads https://github.com/${{ github.repository_owner }}/wai-aria-practices.git apg/${{ github.event.inputs.apg_branch }} | wc -l) | ||
echo "BRANCH_EXISTS=$BRANCH_EXISTS" >> "$GITHUB_OUTPUT" | ||
- name: Clean up generated branch | ||
if: ${{ steps.check_if_exists.outputs.branch-exists == '1' }} | ||
uses: dawidd6/action-delete-branch@v3 | ||
with: | ||
github_token: ${{ github.token }} | ||
branches: apg/${{ github.event.inputs.apg_branch }} | ||
if: ${{ steps.check_if_exists.outputs.BRANCH_EXISTS == '1' }} | ||
run: | | ||
BRANCH_NAME="apg/${{ github.event.inputs.apg_branch }}" | ||
git config --global user.name "w3cgruntbot" | ||
git config --global user.email "[email protected]" | ||
git push origin --delete $BRANCH_NAME | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Report branch already removed | ||
if: ${{ steps.check_if_exists.outputs.branch-exists == '0' }} | ||
if: ${{ steps.check_if_exists.outputs.BRANCH_EXISTS == '0' }} | ||
run: echo "Branch already removed" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.