Twenty app e2e app prod parity dispatch (#21750)
# Introduction On main merge or if PR is labelled with specific label, dispatch the app prod parity check Note: for the moment not optimal for PR context as it will only set a status check on the related commit which is not blocking anything for the moment related https://github.com/twentyhq/core-team-issues/issues/2557 <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21750?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
name: App Prod-Parity E2E Dispatch
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [labeled, synchronize, opened, reopened]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
dispatch:
|
||||
# main push + manual always run; PR events only when the label is present
|
||||
# and the PR comes from a branch in this repo (forks are excluded, since they
|
||||
# have no access to secrets or a writable token for the dispatch).
|
||||
if: >-
|
||||
github.event_name == 'push' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'pull_request' &&
|
||||
github.event.pull_request.head.repo.full_name == github.repository &&
|
||||
contains(github.event.pull_request.labels.*.name, 'run-e2e-apps-prod-parity-tests'))
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
statuses: write
|
||||
steps:
|
||||
- name: Resolve target SHA
|
||||
id: sha
|
||||
env:
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
EVENT_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
if [ -n "$PR_HEAD_SHA" ]; then
|
||||
echo "head_sha=$PR_HEAD_SHA" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "head_sha=$EVENT_SHA" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Post pending status
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
HEAD_SHA: ${{ steps.sha.outputs.head_sha }}
|
||||
run: |
|
||||
gh api "repos/$REPO/statuses/$HEAD_SHA" \
|
||||
-f state=pending \
|
||||
-f context=app-prod-parity-e2e \
|
||||
-f description="Dispatching prod-parity e2e to ci-privileged"
|
||||
|
||||
- name: Mint ci-privileged dispatch token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
||||
with:
|
||||
client-id: ${{ vars.TWENTY_WORKFLOW_DISPATCHER_CLIENT_ID }}
|
||||
private-key: ${{ secrets.TWENTY_WORKFLOW_DISPATCHER_PRIVATE_KEY }}
|
||||
owner: twentyhq
|
||||
repositories: ci-privileged
|
||||
permission-actions: write
|
||||
|
||||
- name: Dispatch to ci-privileged
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
HEAD_SHA: ${{ steps.sha.outputs.head_sha }}
|
||||
run: |
|
||||
gh workflow run app-prod-parity-e2e.yaml \
|
||||
--repo twentyhq/ci-privileged \
|
||||
--ref main \
|
||||
-f head_sha="$HEAD_SHA"
|
||||
|
||||
- name: Post dispatch-failed status
|
||||
if: failure()
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
HEAD_SHA: ${{ steps.sha.outputs.head_sha }}
|
||||
run: |
|
||||
gh api "repos/$REPO/statuses/$HEAD_SHA" \
|
||||
-f state=failure \
|
||||
-f context=app-prod-parity-e2e \
|
||||
-f description="Failed to dispatch prod-parity e2e to ci-privileged"
|
||||
Reference in New Issue
Block a user