-
Notifications
You must be signed in to change notification settings - Fork 83
ACT PR preview setup #2269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
ACT PR preview setup #2269
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8eeec41
Tries logic in new files
daniel-montalvo 724c8aa
Try process.env
daniel-montalvo b61c565
Add createOrCheckoutBranch
daniel-montalvo 1ce9358
Change rule title
daniel-montalvo a994cc7
Revert "Change rule title"
daniel-montalvo a765e09
Write caps
daniel-montalvo 57d87ed
Fix imports
daniel-montalvo ba99c19
no caps
daniel-montalvo bb2cb83
Updates automation
daniel-montalvo e413577
Update workflow
daniel-montalvo 74f2b88
Update git config email
daniel-montalvo 7b718e5
Update git config email
daniel-montalvo 7539f33
;
daniel-montalvo 9d3aed7
Change auth
daniel-montalvo 980f7aa
Update auth
daniel-montalvo 050ed93
Update auth
daniel-montalvo 43f47bc
Repo secrets
daniel-montalvo d13e6f8
Auth for gh cli
daniel-montalvo ee50ffc
Specify permissions
daniel-montalvo eff5804
Right reference to branch_name
daniel-montalvo d6d75ce
Org should be W3C
daniel-montalvo 9fbecb0
Update .github/scripts/commons.mjs
daniel-montalvo 31198f0
Remove assertion
daniel-montalvo ccef4c2
Try relying on const value
daniel-montalvo fbeb091
Define `nv` at a step level
daniel-montalvo da88433
Revert "Define `nv` at a step level"
daniel-montalvo 39a0c3e
Tries pull_request_target
daniel-montalvo ba15ce0
Merge branch 'develop' into develop
daniel-montalvo 9599ba6
Update .github/scripts/commons.mjs
daniel-montalvo 342fa89
Revert "Tries pull_request_target"
daniel-montalvo 5af9984
Add gh_repo setting
daniel-montalvo f78fcd8
workflow_dispatch
daniel-montalvo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env zx | ||
| import 'zx/globals'; | ||
| import { config, cloneWcagActRules, createOrCheckoutBranch, commitAndPush, branchName } from './commons.mjs' | ||
|
|
||
| await cloneWcagActRules(config); | ||
| await createOrCheckoutBranch(config, branchName); | ||
| await generateProposedRulePages(config); | ||
| await generateTestCases(config); | ||
| const commitMessage = (await $`git log -1 --pretty=%B`).stdout; | ||
| await commitAndPush(config, commitMessage); | ||
|
|
||
| async function generateProposedRulePages({ tmpDir, rulesDir, glossaryDir, testAssetsDir }) { | ||
| await $`node ./node_modules/act-tools/dist/cli/rule-transform.js \ | ||
| --rulesDir "${rulesDir}" \ | ||
| --glossaryDir "${glossaryDir}" \ | ||
| --testAssetsDir "${testAssetsDir}" \ | ||
| --outDir "${tmpDir}" \ | ||
| --proposed | ||
| `; | ||
| } | ||
|
|
||
| async function generateTestCases({ tmpDir, rulesDir, testAssetsDir }) { | ||
| await $`node ./node_modules/act-tools/dist/cli/build-examples.js \ | ||
| --rulesDir "${rulesDir}" \ | ||
| --testAssetsDir "${testAssetsDir}" \ | ||
| --outDir "${tmpDir}" \ | ||
| --proposed | ||
| `; | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: PR Preview | ||
| on: | ||
| pull_request: {} | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| dispatch: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| env: | ||
| branch_name: ${{ github.event.pull_request.head.ref }} | ||
| gh_repo: act-rules/act-rules.github.io | ||
| GH_TOKEN: ${{ github.token }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '16' | ||
| cache: npm | ||
| - uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
| - run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Configure git | ||
| run: | | ||
| git config --global url."https://${{ secrets.WAI_GIT_NAME }}:${{ secrets.WAI_GIT_ACCESS_TOKEN }}@github.com".insteadOf "https://github.com" | ||
| git config --global user.name "${{ secrets.WAI_GIT_NAME }}" | ||
| git config --global user.email "${{ secrets.WAI_GIT_EMAIL }}" | ||
| - name: Build and deploy WAI update | ||
| run: npm run pr:preview | ||
| - name: Comment on PR with preview link | ||
| run: | | ||
| gh pr comment ${{ github.event.pull_request.number }} --body "Preview ready at https://deploy-preview-${{ env.branch_name }}--wai-wcag-act-rules.netlify.app" | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.