Skip to content

operator kong-gateway-operator (1.0.0) #8728

operator kong-gateway-operator (1.0.0)

operator kong-gateway-operator (1.0.0) #8728

on: issue_comment
name: Issue Comments - merge
env:
OPP_PRODUCTION_TYPE: "k8s"
OPP_THIS_REPO_NAME: "community-operators"
OPP_THIS_REPO_ORG: "k8s-operatorhub"
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"