Skip to content
Merged
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
21 changes: 19 additions & 2 deletions .github/workflows/cicd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
BASE_BRANCH: origin/main
GO_VERSION: "1.23"

jobs:
trigger-mode:
name: trigger mode
if: github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'pre-approve')
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
outputs:
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }}
trigger-run: ${{ steps.get_trigger_run.outputs.trigger_run }}
git-commit: ${{ steps.get_git_info.outputs.git_commit }}
git-version: ${{ steps.get_git_info.outputs.git_version }}
steps:
Expand All @@ -33,7 +35,22 @@ jobs:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: check run
id: get_trigger_run
run: |
TRIGGER_RUN="false"
PR_NUMBER="${{ github.event.pull_request.number }}"
GITHUB_REPO="${{ github.repository }}"
pr_view_labels=$(gh pr view ${PR_NUMBER} --repo ${GITHUB_REPO} --json "labels")
pr_labels=$(echo "${pr_view_labels}" | jq -r '.labels[].name')
echo "PR LABELS:"$pr_labels
if [[ "${pr_labels}" == *"approved"* || "${pr_labels}" == *"pre-approve"* ]]; then
TRIGGER_RUN="true"
fi
echo "trigger_run="$TRIGGER_RUN >> $GITHUB_OUTPUT

- name: Get trigger mode
if: ${{ steps.get_trigger_run.outputs.trigger_run == 'true' }}
id: get_trigger_mode
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
Expand Down Expand Up @@ -167,7 +184,7 @@ jobs:
pr-check:
name: make test
needs: [ trigger-mode, pr-pre-check, check-image, check-tools-image, check-dataprotection-image, check-helm ]
if: ${{ github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'pre-approve') && always() }}
if: ${{ github.event.action == 'labeled' && needs.trigger-mode.outputs.trigger-run == 'true' && always() }}
runs-on: ubuntu-latest
steps:
- name: pr pre check
Expand Down