Update smoke-test templates #10
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: Update smoke-test templates | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 9 * * 1' # weekly on Monday; job will self-gate to every 10 weeks | |
| permissions: | |
| contents: read | |
| jobs: | |
| gate: | |
| name: Gate to every 10 weeks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check schedule | |
| run: | | |
| set -euo pipefail | |
| week=$(date +%V) | |
| if [ $((10#$week % 10)) -ne 0 ]; then | |
| echo "Skipping: ISO week $week is not a 10-week interval." | |
| exit 0 | |
| fi | |
| update-app-template: | |
| name: Regenerate smoke-tests app template | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| needs: gate | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 20 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| - name: Generate ember-test-app using classic blueprint | |
| run: | | |
| set -euo pipefail | |
| tmpdir=$(mktemp -d) | |
| echo "Using temp dir: $tmpdir" | |
| cd "$tmpdir" | |
| pnpm dlx ember-cli@latest new ember-test-app -b @ember-tooling/classic-build-app-blueprint --no-welcome --skip-git --skip-npm --ember-data=false | |
| node "$GITHUB_WORKSPACE/.github/scripts/update-smoke-test-template.mjs" \ | |
| "$tmpdir/ember-test-app" \ | |
| "$GITHUB_WORKSPACE/smoke-tests/app-template" \ | |
| "true" | |
| - name: Install workspace deps | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Create PR | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| token: ${{ secrets.SMOKE_TEST_TEMPLATE_GEN_TOKEN }} | |
| branch: smoke-tests/update-app-template | |
| delete-branch: false | |
| commit-message: "Update smoke-tests/app-template" | |
| title: "Update smoke tests app-template" | |
| body: | | |
| Regenerated the smoke-tests app-template using ember-cli latest. | |
| update-v2-app-template: | |
| name: Regenerate smoke-tests v2 app template | |
| runs-on: ubuntu-latest | |
| needs: gate | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 20 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| - name: Generate v2-app-template | |
| run: | | |
| set -euo pipefail | |
| tmpdir=$(mktemp -d) | |
| echo "Using temp dir: $tmpdir" | |
| cd "$tmpdir" | |
| pnpm dlx ember-cli@latest new v2-app-template --no-welcome --skip-git --skip-npm --ember-data=false | |
| node "$GITHUB_WORKSPACE/.github/scripts/update-smoke-test-template.mjs" \ | |
| "$tmpdir/v2-app-template" \ | |
| "$GITHUB_WORKSPACE/smoke-tests/v2-app-template" | |
| - name: Install workspace deps | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Create PR | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| token: ${{ secrets.SMOKE_TEST_TEMPLATE_GEN_TOKEN }} | |
| branch: smoke-tests/update-v2-app-template | |
| delete-branch: false | |
| commit-message: "Update smoke-tests/v2-app-template" | |
| title: "Update smoke tests v2-app-template" | |
| body: | | |
| Regenerated the smoke-tests v2-app-template using ember-cli latest. | |
| report-failure: | |
| name: Report failure | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| needs: | |
| - update-app-template | |
| - update-v2-app-template | |
| if: failure() | |
| steps: | |
| - name: Create issue | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| const title = "Smoke-test app template update failed"; | |
| const body = [ | |
| "The scheduled smoke-test app template update workflow failed.", | |
| "", | |
| `Run: ${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`, | |
| "", | |
| `Attempt: ${process.env.GITHUB_RUN_ATTEMPT}` | |
| ].join("\\n"); | |
| const { data: existing } = await github.rest.search.issuesAndPullRequests({ | |
| q: `repo:${context.repo.owner}/${context.repo.repo} is:issue is:open in:title "${title}"` | |
| }); | |
| if (existing.items.length > 0) { | |
| core.info(`Existing issue found: #${existing.items[0].number}`); | |
| return; | |
| } | |
| const { data: issue } = await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title, | |
| body, | |
| assignees: ["kategengler"] | |
| }); | |
| core.info(`Created issue #${issue.number}`); |