2021-07-24 11:03:17 +00:00
|
|
|
---
|
|
|
|
name: "Metadata: Label pull requests CI status"
|
|
|
|
|
|
|
|
on:
|
2021-07-24 12:25:54 +00:00
|
|
|
workflow_run:
|
|
|
|
workflows:
|
|
|
|
- "Pre-commit consistency check"
|
|
|
|
- "Charts: Lint and test"
|
|
|
|
types:
|
|
|
|
- completed
|
2021-07-24 11:03:17 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-07-24 12:22:58 +00:00
|
|
|
label-precommit:
|
|
|
|
name: Label pre-commit status
|
|
|
|
runs-on: ubuntu-20.04
|
2021-07-24 12:41:27 +00:00
|
|
|
if: "${{ github.event.workflow.name == 'Pre-commit consistency check' }}"
|
2021-07-24 12:22:58 +00:00
|
|
|
steps:
|
|
|
|
- uses: getsentry/action-github-app-token@v1
|
|
|
|
id: get-app-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.K8S_AT_HOME_APP_ID }}
|
|
|
|
private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }}
|
2021-07-24 11:37:05 +00:00
|
|
|
|
2021-07-24 12:54:57 +00:00
|
|
|
- name: "Get information about the origin 'CI' run"
|
|
|
|
uses: potiuk/get-workflow-origin@v1_3
|
|
|
|
id: source-run-info
|
|
|
|
with:
|
|
|
|
token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
sourceRunId: ${{ github.event.workflow_run.id }}
|
|
|
|
|
2021-07-24 12:49:41 +00:00
|
|
|
# CI Passed
|
|
|
|
- name: "add label: ok"
|
|
|
|
uses: actions-ecosystem/action-add-labels@v1
|
2021-07-24 12:22:58 +00:00
|
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
|
|
with:
|
2021-07-24 12:49:41 +00:00
|
|
|
github_token: ${{ steps.get-app-token.outputs.token }}
|
2021-07-24 12:54:57 +00:00
|
|
|
number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
2021-07-24 12:49:41 +00:00
|
|
|
labels: "precommit:ok"
|
2021-07-24 11:37:05 +00:00
|
|
|
|
2021-07-24 12:49:41 +00:00
|
|
|
- name: "remove label: failed"
|
|
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
|
|
with:
|
|
|
|
github_token: ${{ steps.get-app-token.outputs.token }}
|
2021-07-24 12:54:57 +00:00
|
|
|
number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
2021-07-24 12:49:41 +00:00
|
|
|
labels: "precommit:failed"
|
|
|
|
|
|
|
|
# CI Failed
|
|
|
|
- name: "add label: failed"
|
|
|
|
uses: actions-ecosystem/action-add-labels@v1
|
2021-07-24 12:41:27 +00:00
|
|
|
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
|
|
with:
|
2021-07-24 12:49:41 +00:00
|
|
|
github_token: ${{ steps.get-app-token.outputs.token }}
|
2021-07-24 12:54:57 +00:00
|
|
|
number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
2021-07-24 12:49:41 +00:00
|
|
|
labels: "precommit:failed"
|
|
|
|
|
|
|
|
- name: "remove label: ok"
|
|
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
|
|
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
|
|
with:
|
|
|
|
github_token: ${{ steps.get-app-token.outputs.token }}
|
2021-07-24 12:54:57 +00:00
|
|
|
number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
2021-07-24 12:49:41 +00:00
|
|
|
labels: "precommit:ok"
|
2021-07-24 11:45:11 +00:00
|
|
|
|
2021-07-24 12:41:27 +00:00
|
|
|
label-lint-install:
|
|
|
|
name: Label lint and install status
|
|
|
|
runs-on: ubuntu-20.04
|
2021-07-24 12:54:57 +00:00
|
|
|
if: "${{ github.event.workflow.name == 'Charts: Lint and test' }}"
|
2021-07-24 12:41:27 +00:00
|
|
|
steps:
|
|
|
|
- uses: getsentry/action-github-app-token@v1
|
|
|
|
id: get-app-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.K8S_AT_HOME_APP_ID }}
|
|
|
|
private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }}
|
2021-07-24 11:45:11 +00:00
|
|
|
|
2021-07-24 12:54:57 +00:00
|
|
|
- name: "Get information about the origin 'CI' run"
|
|
|
|
uses: potiuk/get-workflow-origin@v1_3
|
|
|
|
id: source-run-info
|
|
|
|
with:
|
|
|
|
token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
sourceRunId: ${{ github.event.workflow_run.id }}
|
|
|
|
|
2021-07-24 13:03:27 +00:00
|
|
|
- name: "Get workflow jobs"
|
2021-07-24 12:41:27 +00:00
|
|
|
uses: actions/github-script@v4
|
2021-07-24 13:03:27 +00:00
|
|
|
id: get-workflow-jobs
|
2021-07-24 12:41:27 +00:00
|
|
|
with:
|
|
|
|
github-token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
script: |
|
2021-07-24 12:58:31 +00:00
|
|
|
const wfJobs = await github.actions.listJobsForWorkflowRun({
|
2021-07-24 12:41:27 +00:00
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
2021-07-24 12:49:41 +00:00
|
|
|
run_id: context.payload.workflow_run.id,
|
2021-07-24 12:41:27 +00:00
|
|
|
});
|
2021-07-24 13:03:27 +00:00
|
|
|
return wfJobs.jobs
|
|
|
|
|
|
|
|
- name: Get result
|
|
|
|
run: echo "${{steps.get-workflow-jobs.outputs.result}}"
|
2021-07-24 11:45:11 +00:00
|
|
|
|
2021-07-24 12:49:41 +00:00
|
|
|
# # CI Passed
|
|
|
|
# - name: "add label: ok"
|
|
|
|
# uses: actions-ecosystem/action-add-labels@v1
|
|
|
|
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
|
|
# with:
|
|
|
|
# github_token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
# number: ${{ needs.get-info.outputs.pullRequestNumber }}
|
|
|
|
# labels: "lint:ok"
|
2021-07-24 11:45:11 +00:00
|
|
|
|
2021-07-24 12:49:41 +00:00
|
|
|
# - name: "remove label: failed"
|
|
|
|
# uses: actions-ecosystem/action-remove-labels@v1
|
|
|
|
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
|
|
# with:
|
|
|
|
# github_token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
# number: ${{ needs.get-info.outputs.pullRequestNumber }}
|
|
|
|
# labels: "lint:failed"
|
2021-07-24 11:45:11 +00:00
|
|
|
|
2021-07-24 12:49:41 +00:00
|
|
|
# # CI Failed
|
|
|
|
# - name: "add label: failed"
|
|
|
|
# uses: actions-ecosystem/action-add-labels@v1
|
|
|
|
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
|
|
# with:
|
|
|
|
# github_token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
# number: ${{ needs.get-info.outputs.pullRequestNumber }}
|
|
|
|
# labels: "lint:failed"
|
2021-07-24 12:01:03 +00:00
|
|
|
|
2021-07-24 12:49:41 +00:00
|
|
|
# - name: "remove label: ok"
|
|
|
|
# uses: actions-ecosystem/action-remove-labels@v1
|
|
|
|
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
|
|
# with:
|
|
|
|
# github_token: ${{ steps.get-app-token.outputs.token }}
|
|
|
|
# number: ${{ needs.get-info.outputs.pullRequestNumber }}
|
|
|
|
# labels: "lint:ok"
|