Skip to content

chore(deps): update github/codeql-action digest to b1bff81 #5107

chore(deps): update github/codeql-action digest to b1bff81

chore(deps): update github/codeql-action digest to b1bff81 #5107

name: 📦❓ Check test project fixture
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
permissions: {}
jobs:
check-test-project-fixture:
# The only labeled or unlabeled event that should trigger this workflow is
# when the fixture-ok label is added or removed.
if: >-
github.repository == 'cedarjs/cedar' &&
(
(github.event.action != 'labeled' && github.event.action != 'unlabeled') ||
github.event.label.name == 'fixture-ok'
)
name: Check test project fixture
runs-on: ubuntu-latest
# Cancel in-progress runs of this workflow.
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up job (detect changes)
uses: ./.github/actions/set-up-job
with:
set-up-yarn-cache: false
yarn-install-directory: ./.github/actions/detect-changes
build: false
- name: 🔍 Detect changes
id: detect-changes
uses: ./.github/actions/detect-changes
- name: Set up job (fixture)
if: steps.detect-changes.outputs.code == 'true' && !contains(github.event.pull_request.labels.*.name, 'fixture-ok')
uses: ./.github/actions/set-up-job
- name: Rebuild test-project fixture
if: steps.detect-changes.outputs.code == 'true' && !contains(github.event.pull_request.labels.*.name, 'fixture-ok')
run: |
# Temporarily disable errexit so we can capture the pipeline exit code
# produced by `yarn ... | tee ...` without the shell aborting the step
# before we can inspect the exit status.
set +e
# Exit early on errors and ensure we capture the full output for
# inspection.
set -o pipefail
# Run the rebuild and capture both stdout/stderr.
yarn rebuild-test-project-fixture 2>&1 | tee rebuild-output.log
rc=${PIPESTATUS[0]}
# Re-enable errexit so subsequent checks fail fast.
set -e
# If the command itself exited non-zero, fail the step.
if [ ${rc} -ne 0 ]; then
echo "yarn rebuild-test-project-fixture exited with code ${rc}"
exit ${rc}
fi
# Even if the command exited zero, search the output for failure
# indicators. Ideally this shouldn't be needed and the script would
# always return != 0 on failure, but I'm not sure it does. So this
# is an extra safety measure.
if grep -Eq "Failed |Error: Failed|ENOENT: no such file or directory" rebuild-output.log; then
echo "Detected failure text in rebuild-test-project-fixture output"
exit 1
fi
# Ensure the script printed the expected success message.
# Again, this ideally shouldn't be needed.
if ! grep -Fq "Success! The test project fixture has been rebuilt" rebuild-output.log; then
echo "Rebuild did not print success message"
exit 1
fi
rm rebuild-output.log
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Check for changed files
if: steps.detect-changes.outputs.code == 'true' && !contains(github.event.pull_request.labels.*.name, 'fixture-ok')
run: |
if [ $(git status --porcelain | wc -l) -gt 0 ]; then
echo 'Updating the test project fixture caused files to change'
echo 'Please run `yarn rebuild-test-project-fixture` locally and commit any changes'
echo
echo 'Deleted files:'
git status --porcelain | grep '^ D ' | awk '{print " " $2}'
echo
echo 'Modified files:'
git status --porcelain | grep '^ M ' | awk '{print " " $2}'
echo
echo 'Untracked files:'
git status --porcelain | grep '^?? ' | awk '{print " " $2}'
echo
echo
echo 'Full diff:'
git diff
exit 1;
fi