operator [O] kubero-operator (0.0.99) #4198
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
on: issue_comment | |
name: Issue Comments - merge | |
env: | |
OPP_PRODUCTION_TYPE: "k8s" | |
OPP_THIS_REPO_NAME: "community-operators-pipeline" | |
OPP_THIS_REPO_ORG: "redhat-openshift-ecosystem" | |
jobs: | |
handle_comments: | |
name: Check comments for /merge | |
if: | | |
startsWith(github.event.comment.body, '/merge') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v6 | |
id: labels | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labels = await github.rest.issues.listLabelsOnIssue({ | |
issue_number: context.payload.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}) | |
console.log(labels.data) | |
return labels.data | |
- name: Merge command handler | |
id: command | |
uses: xt0rted/slash-command-action@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
command: merge | |
reaction: "true" | |
reaction-type: "eyes" | |
allow-edits: "false" | |
permission-level: write | |
- name: Merge message when not able to merge and inform user about authorized_changes | |
uses: actions/github-script@v6 | |
if: | | |
steps.command.outputs.command-name == 'merge' && | |
steps.command.outputs.command-arguments == 'possible' && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'authorized-changes')) && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-validated')) && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'package-validated')) && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'new-operator')) && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'do-not-merge/work-in-progress')) && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'do-not-merge/hold')) | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Current PR can be merged automatically, but there is missing `authorized-changes` label. One can find out more info [here](https://${OPP_THIS_REPO_ORG}.github.io/${OPP_THIS_REPO_NAME}/operator-ci-yaml/#reviewers).' | |
}) | |
- name: Message when automerge is disabled | |
uses: actions/github-script@v6 | |
if: | | |
steps.command.outputs.command-name == 'merge' && | |
steps.command.outputs.command-arguments == 'possible' && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'automerge-disabled')) | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Automatic merge is disabled temporarily due to a maintenance.' | |
}) | |
- name: Message when dco-failed is missing | |
uses: actions/github-script@v6 | |
if: | | |
steps.command.outputs.command-name == 'merge' && | |
steps.command.outputs.command-arguments == 'possible' && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'dco-failed')) | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'DCO is missing. Please signoff your commits !!!' | |
}) | |
- name: automerge | |
if: steps.command.outputs.command-name == 'merge' && steps.command.outputs.command-arguments == 'possible' | |
uses: "pascalgn/[email protected]" | |
env: | |
GITHUB_TOKEN: "${{ secrets.FRAMEWORK_MERGE }}" | |
MERGE_LABELS: "authorized-changes,package-validated,installation-validated,!do-not-merge/hold,!do-not-merge/work-in-progress,!automerge-disabled,!dco-failed" | |
MERGE_REMOVE_LABELS: "" | |
MERGE_METHOD: "squash" | |
MERGE_COMMIT_MESSAGE: "pull-request-title" | |
MERGE_FORKS: "true" | |
MERGE_RETRIES: "6" | |
MERGE_RETRY_SLEEP: "10000" |