Skip to content

[#73462] Vertically center Backlogs Inbox counter #12155

[#73462] Vertically center Backlogs Inbox counter

[#73462] Vertically center Backlogs Inbox counter #12155

Workflow file for this run

name: downstream-ci
on:
push:
branches:
- dev
- 'release/**'
paths-ignore:
- 'docs/**'
- 'help/**'
pull_request:
types: [opened, reopened, synchronize]
branches:
- dev
- 'release/**'
paths-ignore:
- 'docs/**'
- 'help/**'
- 'packaging/**'
- '.pkgr.yml'
permissions:
contents: read
jobs:
trigger_saas_tests:
permissions:
contents: none
if: github.repository == 'opf/openproject' && github.actor != 'dependabot[bot]'
name: SaaS tests
runs-on: ubuntu-latest
steps:
- name: Trigger SaaS Tests
env:
TOKEN: ${{ secrets.OPENPROJECTCI_GH_SAAS_WORKFLOW_PAT }}
REPOSITORY: opf/saas-openproject
WORKFLOW_ID: test-saas.yml
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
REF_NAME: ${{ github.ref_name }}
THIS_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# ref:
# * on push this will be `dev` or a specific release branch (e.g. release/16.1) - there is always a matching branch for that downstream
# * on pull_request we use the PR branch's base (e.g. dev or a release branch) to match the above
# core_ref:
# * the name of the core branch that has to be checked out downstream to run the tests
# * that is either dev, release/16.1 (for instance), or the pull request's branch name
run: |
echo Triggering downstream workflow
REF=''
CORE_REF=''
if [ "$EVENT_NAME" = "pull_request" ]; then
echo The workflow was triggered by a pull request targetting the dev or a release branch
REF="$BASE_REF"
CORE_REF="$HEAD_REF"
else
echo The workflow was triggered by a push to the dev or a release branch
REF="$REF_NAME"
CORE_REF="$REF"
fi
if [[ ! "$REF" =~ dev|release/.+ ]]; then
echo "Base branch is not dev or release branch. Cannot check downstream tests."
exit 0
fi
PAYLOAD=$(jq -n --arg ref "$REF" --arg core_ref "$CORE_REF" --arg triggered_by_url "$THIS_RUN_URL" \
'{"ref": $ref, "inputs": {"core_ref": $core_ref, "triggered_by_url": $triggered_by_url}}')
OUTPUT_FILE=/tmp/request-output
echo "Triggering $WORKFLOW_ID workflow on $REPOSITORY branch '$REF', which will check out core branch '$CORE_REF'"
status=$(
curl -i --fail-with-body --silent --output $OUTPUT_FILE --write-out "%{http_code}" \
-H"authorization: Bearer $TOKEN" -H"Accept: application/vnd.github.v3+json" \
-XPOST \
-d "$PAYLOAD" \
https://api.github.com/repos/$REPOSITORY/actions/workflows/$WORKFLOW_ID/dispatches
)
if [[ "$status" =~ ^2..$ ]]; then
echo Downstream workflow triggered successfully
else
echo Failed to trigger downstream workflow:
echo
cat $OUTPUT_FILE
exit 1
fi