chore(deps-dev): Bump @types/node from 24.7.1 to 24.7.2 in /.github/actions/file #24
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
name: Test | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
workflow_dispatch: | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false # Allow previous workflows’ clean-up steps to complete | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
# Run if triggered manually, or for a non-draft PR | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
strategy: | |
matrix: | |
site: ["sites/site-with-errors"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@ab177d40ee5483edb974554986f56b33477e21d0 | |
with: | |
ruby-version: "3.4" | |
bundler-cache: true | |
working-directory: ${{ matrix.site }} | |
- name: Build Jekyll site (${{ matrix.site }}) | |
shell: bash | |
working-directory: ${{ matrix.site }} | |
env: | |
JEKYLL_ENV: production | |
run: bundle exec jekyll build | |
- name: Start Puma (${{ matrix.site }}) | |
shell: bash | |
working-directory: ${{ matrix.site }} | |
env: | |
TEST_USERNAME: ${{ secrets.TEST_USERNAME }} | |
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} | |
run: | | |
set -euo pipefail | |
bundle exec puma -b tcp://127.0.0.1:4000 & | |
echo "Starting Puma on port 4000" | |
curl -fsS --retry 25 --retry-delay 1 --retry-all-errors -u "${TEST_USERNAME}:${TEST_PASSWORD}" "http://127.0.0.1:4000/" > /dev/null | |
echo "Puma has started" | |
- name: Generate cache key | |
id: cache_key | |
shell: bash | |
run: | | |
echo "cache_key=$(printf 'cached_results-%s-%s.json' "${{ matrix.site }}" "${{ github.ref_name }}" | tr -cs 'A-Za-z0-9._-' '_')" >> $GITHUB_OUTPUT | |
- name: Scan site (${{ matrix.site }}) | |
uses: ./ | |
with: | |
urls: | | |
http://127.0.0.1:4000/ | |
http://127.0.0.1:4000/jekyll/update/2025/07/30/welcome-to-jekyll.html | |
http://127.0.0.1:4000/about/ | |
http://127.0.0.1:4000/404.html | |
login_url: http://127.0.0.1:4000/ | |
username: ${{ secrets.TEST_USERNAME }} | |
password: ${{ secrets.TEST_PASSWORD }} | |
repository: github/accessibility-scanner-testing | |
token: ${{ secrets.GH_TOKEN }} | |
cache_key: ${{ steps.cache_key.outputs.cache_key }} | |
- name: Retrieve cached results | |
uses: ./.github/actions/gh-cache/restore | |
with: | |
path: ${{ steps.cache_key.outputs.cache_key }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Validate scan results (${{ matrix.site }}) | |
run: | | |
npm ci | |
npm run test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
CACHE_PATH: ${{ steps.cache_key.outputs.cache_key }} | |
- name: Clean up issues and pull requests | |
if: ${{ always() }} | |
shell: bash | |
run: | | |
set -euo pipefail | |
if [[ ! -f "${{ steps.cache_key.outputs.cache_key }}" ]]; then | |
echo "Skipping 'Clean up issues and pull requests' (no cached results)." | |
exit 0 | |
fi | |
jq -r ' | |
(if type=="string" then fromjson else . end) | |
| .[] | .issue.url, .pullRequest.url | |
| select(. != null) | |
' "${{ steps.cache_key.outputs.cache_key }}" \ | |
| while read -r URL; do | |
if [[ "$URL" == *"/pull/"* ]]; then | |
echo "Closing pull request: $URL" | |
gh pr close "$URL" || echo "Failed to close pull request: $URL" | |
elif [[ "$URL" == *"/issues/"* ]]; then | |
echo "Closing issue: $URL" | |
gh issue close "$URL" || echo "Failed to close issue: $URL" | |
else | |
echo "Skipping unrecognized url: $URL" | |
fi | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Clean up cached results | |
if: ${{ always() }} | |
uses: ./.github/actions/gh-cache/delete | |
with: | |
path: ${{ steps.cache_key.outputs.cache_key }} | |
token: ${{ secrets.GITHUB_TOKEN }} |