openshift-test-status #38203
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
name: Report Openshift status | |
on: | |
repository_dispatch: | |
types: | |
- manual-openshift-report | |
- openshift-test-status | |
env: | |
OPP_PRODUCTION_TYPE: "ocp" | |
jobs: | |
remove-add-label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Info" | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
console.log(context.payload.client_payload.source_pr) | |
console.log(context.payload.client_payload.remove_labels) | |
console.log(context.payload.client_payload.add_labels) | |
continue-on-error: true | |
- name: "Remove labels" | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
if (context.payload.client_payload.remove_labels != undefined) { | |
for (const label of context.payload.client_payload.remove_labels) { | |
github.rest.issues.removeLabel({ | |
issue_number: context.payload.client_payload.source_pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: label | |
}) | |
} | |
} | |
continue-on-error: true | |
- name: "Add labels" | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
if (context.payload.client_payload.add_labels != undefined) { | |
github.rest.issues.addLabels({ | |
issue_number: context.payload.client_payload.source_pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: context.payload.client_payload.add_labels | |
}) | |
} | |
- 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.client_payload.source_pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}) | |
console.log(labels.data) | |
return labels.data | |
- name: Add installation final label | |
uses: actions/github-script@v6 | |
if: | | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-failed-4.10')) && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-failed-4.11')) && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-failed-4.12')) && | |
(!contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-failed-4.13')) && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-validated-4.10')) && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-validated-4.11')) && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-validated-4.12')) && | |
(contains(fromJSON(steps.labels.outputs.result).*.name, 'installation-validated-4.13')) | |
continue-on-error: true | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.payload.client_payload.source_pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: [ 'installation-validated' ] | |
}) | |
- uses: actions/github-script@v6 | |
id: labels2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labels = await github.rest.issues.listLabelsOnIssue({ | |
issue_number: context.payload.client_payload.source_pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}) | |
console.log(labels.data) | |
return labels.data | |
- uses: actions/github-script@v6 | |
if: | | |
(contains(fromJSON(steps.labels2.outputs.result).*.name, 'installation-validated')) | |
with: | |
github-token: ${{ secrets.FRAMEWORK_MERGE }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.payload.client_payload.source_pr, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '/merge possible' | |
}) |