-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1021 from frontegg/FR-13416-trigger-e2e-tests
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Trigger E2E tests Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
dispatch_id: | ||
description: 'Dispatch Id (repo/sha)' | ||
required: true | ||
|
||
jobs: | ||
trigger_e2e_tests: | ||
name: "Trigger E2E tests Workflow" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Trigger E2E tests" | ||
uses: actions/github-script@v5 | ||
env: | ||
version: ${{ inputs.version }} | ||
dispatch_id: ${{ inputs.dispatch_id }} | ||
with: | ||
github-token: ${{ secrets.GH_REPOSITORY_ADMIN_TOKEN }} | ||
script: | | ||
const {repo, sha, version} = process.env; | ||
const owner = context.payload.repository.organization | ||
const e2eRepo = 'e2e-system-tests' | ||
const workflow_id = 'frontegg-react-e2e-tests.yml' | ||
const context = `${owner}/${e2eRepo}` | ||
const dispatch_id = `${repo}/${sha}` | ||
const res = await github.rest.repos.createCommitStatus({ | ||
context, owner, repo, sha, | ||
state: 'pending', | ||
description: 'Dispatching E2E tests...', | ||
}); | ||
const data = await github.rest.actions.createWorkflowDispatch({ | ||
owner, | ||
repo:e2eRepo, | ||
workflow_id, | ||
ref: 'main', | ||
inputs: { | ||
version, | ||
dispatch_id, | ||
} | ||
}); |