forked from k8s-operatorhub/community-operators
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (102 loc) · 4.38 KB
/
operator_ci_approved.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Operator CI APPROVED
on:
pull_request_target:
types: [ready_for_review]
branches:
- master
- main
env:
OPP_DEBUG: 1
OPP_CONTAINER_OPT: "-t"
OPP_SCRIPT_URL: "https://raw.githubusercontent.com/redhat-openshift-ecosystem/community-operators-pipeline/ci/latest/ci/scripts/opp.sh"
OPP_SCRIPT_ENV_URL: "https://raw.githubusercontent.com/redhat-openshift-ecosystem/community-operators-pipeline/ci/latest/ci/scripts/opp-env.sh"
OPP_SCRIPT_ENV_OPRT_URL: "https://raw.githubusercontent.com/redhat-openshift-ecosystem/community-operators-pipeline/ci/latest/ci/scripts/opp-oprt.sh"
OPP_IMAGE: "quay.io/operator_testing/operator-test-playbooks:latest"
OPP_ANSIBLE_PULL_REPO: "https://github.com/redhat-openshift-ecosystem/operator-test-playbooks"
OPP_ANSIBLE_PULL_BRANCH: "upstream-community"
OPP_THIS_REPO_BASE: "https://github.com"
OPP_THIS_REPO: "k8s-operatorhub/community-operators"
OPP_THIS_BRANCH: "main"
OPP_PROD: 0
OPP_DRY_RUN: 0
KIND_KUBE_VERSION: "v1.30.0"
OPP_PRODUCTION_TYPE: "k8s"
OPP_REVIEWERS_ENABLED: 1
jobs:
approved-list-handler:
runs-on: ubuntu-latest
if: github.event.pull_request.state == 'open' && github.event.action == 'ready_for_review'
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install --upgrade pip yq
# - name: Check approved list
# id: op-approved-list
# continue-on-error: true
# env:
# OPP_THIS_PR: ${{ github.event.pull_request.number }}
# run: |
# echo "OPP_THIS_PR=$OPP_THIS_PR"
# curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$OPP_THIS_REPO/pulls/$OPP_THIS_PR/reviews | jq '[.[] | {user: .user.login, state: .state}] | map(select(.state == "APPROVED")) | .[].user'
- name: Operator traffic light
id: op-traffic-light
env:
OPP_LABELS: "${{ join(github.event.pull_request.labels.*.name, ' ') }}"
OPP_PR_AUTHOR: "${{ github.event.pull_request.user.login }}"
OPP_OPRT_REPO: "${{ github.event.pull_request.head.repo.full_name }}"
OPP_OPRT_SHA: "${{ github.event.pull_request.head.sha }}"
OPP_OPRT_SRC_REPO: "${{ github.event.pull_request.base.repo.full_name }}"
OPP_OPRT_SRC_BRANCH: "${{ github.event.pull_request.base.ref }}"
OPP_THIS_PR: ${{ github.event.pull_request.number }}
run: |
echo "Using script '$OPP_SCRIPT_ENV_OPRT_URL' ..."
echo "global labels $OPP_LABELS"
bash <(curl -sL $OPP_SCRIPT_ENV_OPRT_URL)
- name: "Setting authorized-changes label"
uses: actions/github-script@v6
continue-on-error: true
if: steps.op-traffic-light.outputs.opp_authorized_changes == '1'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [ 'authorized-changes' ]
})
# - name: "Mention reviewers if exist"
# uses: mshick/add-pr-comment@v1
# with:
# message: |
# PR approved
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
# allow-repeats: false
# - name: "Setting authorized-changes label"
# uses: actions/github-script@v6
# if: steps.op-traffic-light.outputs.opp_authorized_changes == '1'
# with:
# github-token: ${{secrets.GITHUB_TOKEN}}
# script: |
# github.rest.issues.addLabels({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# labels: [ 'authorized-changes' ]
# })
# - name: Try to automerge
# uses: actions/github-script@v6
# continue-on-error: true
# with:
# github-token: ${{ secrets.FRAMEWORK_MERGE }}
# script: |
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: '/merge possible'
# })