Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/staging-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
workflow_dispatch:

permissions:
# Manual dispatch queries workflow runs for the selected main commit.
actions: read
Comment thread
Programcode marked this conversation as resolved.
Resolved
contents: read

concurrency:
Expand All @@ -32,6 +34,20 @@ jobs:
persist-credentials: false
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}

- name: Verify selected commit passed the quality workflow
if: github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
successful_runs="$(gh api \
"repos/${GITHUB_REPOSITORY}/actions/workflows/deploy.yml/runs?head_sha=${GITHUB_SHA}&event=push&status=success&per_page=1" \
--jq '.workflow_runs | length')"
if [ "$successful_runs" -ne 1 ]; then
echo "::error::The selected main commit has no successful push run of Build and Push Docker Image"
exit 1
fi

- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
Expand Down
6 changes: 6 additions & 0 deletions src/test/runtime-contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ describe('runtime integration contracts', () => {
const workflow = readProjectFile('.github/workflows/staging-e2e.yml');
expect(workflow).not.toContain('actions/upload-artifact');
expect(workflow).not.toContain('test-results/**/*.webm');
expect(workflow).toContain('actions: read');
expect(workflow).toContain('Verify selected commit passed the quality workflow');
expect(workflow).toContain("if: github.event_name == 'workflow_dispatch'");
expect(workflow).toContain('head_sha=${GITHUB_SHA}&event=push&status=success');
Comment thread
Programcode marked this conversation as resolved.
Resolved
expect(workflow).toContain('if [ "$successful_runs" -ne 1 ]');
expect(workflow).toContain('exit 1');
});

it('keeps pull-request browser checks separate from Docker publication', () => {
Expand Down
Loading