VACMS-15345: Remove mobile promo banner feature flag #386
Workflow file for this run
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: Set Test Statuses | |
on: | |
- pull_request_target | |
permissions: | |
pull-requests: write | |
checks: write | |
contents: write | |
statuses: write | |
jobs: | |
# Tugboat tests are not automatically set pending, even though they are | |
# required in branch protection rules (see #10553). | |
# | |
# Therefore, a PR can inappropriately appear to be ready to merge if, | |
# for instance, a composer.lock merge conflict prevents the Tugboat | |
# preview from successfully building. | |
# | |
# Additionally, CI tests are only run for code changes but they are | |
# required checks, even for documentation only changes. In these cases, | |
# the tests should be skipped since no functional changes have occured. | |
# | |
# To address these two issues, this action sets check statuses directly | |
# to the appropriate states: | |
# - For docs only changes, all required checks are set to 'success' | |
# - For code changes, Tugboat tests are set to 'pending' so that we can | |
# trust our automated code review processes more. | |
set-test-statuses: | |
name: Set Tests Statuses | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for documentation only changes | |
id: docs-only | |
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | |
with: | |
script: | | |
const opts = github.rest.pulls.listFiles.endpoint.merge({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.payload.pull_request.number, | |
}) | |
const files = await github.paginate( | |
opts, | |
(response) => response.data.map( | |
(file) => file.filename | |
) | |
) | |
for (const file of files) { | |
console.log(`Checking PR file: ${file}`) | |
if (!file.endsWith('.md')) { | |
console.log(`Code change found in: ${file}`) | |
return "false" | |
} | |
} | |
console.log(`No code change found.`) | |
return "true" | |
result-encoding: string | |
- name: Set status for documentation changes. | |
if: ${{ steps.docs-only.outputs.result == 'true' }} | |
run: | | |
test_names=( | |
va/tests/cypress | |
va/tests/phpunit | |
va/tests/content-build-gql | |
va/tests/status-error | |
'Composer Validate' | |
'Check Fields' | |
ESLint | |
Stylelint | |
PHPStan | |
PHPUnit | |
PHP_CodeSniffer | |
'PHP Lint' | |
) | |
for test_name in "${test_names[@]}"; do | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
"/repos/${GITHUB_REPOSITORY}/statuses/${SHA}" \ | |
-f state='success' \ | |
-f context="${test_name}"; | |
done; | |
env: | |
SHA: ${{ github.event.pull_request.head.sha }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set status for code changes. | |
if: ${{ steps.docs-only.outputs.result == 'false' }} | |
run: | | |
test_names=( | |
va/tests/cypress | |
va/tests/phpunit | |
va/tests/content-build-gql | |
va/tests/status-error | |
) | |
for test_name in "${test_names[@]}"; do | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
"/repos/${GITHUB_REPOSITORY}/statuses/${SHA}" \ | |
-f state='pending' \ | |
-f context="${test_name}"; | |
done; | |
env: | |
SHA: ${{ github.event.pull_request.head.sha }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |