mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-02-02 23:39:03 +00:00
ci: Simplify label workflow
Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
parent
cfca06cb46
commit
34bcb259ea
143
.github/workflows/metadata-label-pr-ci-status.yaml
vendored
143
.github/workflows/metadata-label-pr-ci-status.yaml
vendored
@ -28,40 +28,23 @@ jobs:
|
|||||||
token: ${{ steps.get-app-token.outputs.token }}
|
token: ${{ steps.get-app-token.outputs.token }}
|
||||||
sourceRunId: ${{ github.event.workflow_run.id }}
|
sourceRunId: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
- name: "Label precommit status"
|
- name: Label precommit success
|
||||||
uses: actions/github-script@v4
|
uses: andymckay/labeler@1.0.3
|
||||||
|
if: "${{ github.event.workflow_run.conclusion }} == 'success'"
|
||||||
with:
|
with:
|
||||||
github-token: ${{ steps.get-app-token.outputs.token }}
|
repo-token: ${{ steps.get-app-token.outputs.token }}
|
||||||
script: |
|
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
||||||
var LABEL_ADD
|
add-labels: "precommit:ok"
|
||||||
var LABEL_REMOVE
|
remove-labels: "precommit:failed"
|
||||||
if ('${{ github.event.workflow_run.conclusion }}' == 'success') {
|
|
||||||
LABEL_ADD = 'precommit:ok'
|
|
||||||
LABEL_REMOVE = 'precommit:failed'
|
|
||||||
} else {
|
|
||||||
LABEL_ADD = 'precommit:failed'
|
|
||||||
LABEL_REMOVE = 'precommit:ok'
|
|
||||||
}
|
|
||||||
|
|
||||||
await github.issues.addLabels({
|
- name: Label precommit failure
|
||||||
issue_number: ${{ steps.source-run-info.outputs.pullRequestNumber }},
|
uses: andymckay/labeler@1.0.3
|
||||||
owner: context.repo.owner,
|
if: "${{ github.event.workflow_run.conclusion }} == 'failure'"
|
||||||
repo: context.repo.repo,
|
with:
|
||||||
labels: [LABEL_ADD]
|
repo-token: ${{ steps.get-app-token.outputs.token }}
|
||||||
})
|
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
||||||
await github.issues.removeLabel({
|
add-labels: "precommit:failed"
|
||||||
issue_number: ${{ steps.source-run-info.outputs.pullRequestNumber }},
|
remove-labels: "precommit:ok"
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
name: LABEL_REMOVE
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
// Ignore errors that provide the label is not there
|
|
||||||
if (err.status !== 404 && err.status !== 410) {
|
|
||||||
core.error(`Unexpected error status: ${err.status} with message: ${err.message}`);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
label-lint-install:
|
label-lint-install:
|
||||||
name: Label lint and install status
|
name: Label lint and install status
|
||||||
@ -106,72 +89,38 @@ jobs:
|
|||||||
console.log(result)
|
console.log(result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
- name: "Label lint status"
|
- name: Label lint success
|
||||||
uses: actions/github-script@v4
|
uses: andymckay/labeler@1.0.3
|
||||||
|
if: "${{ fromJSON(steps.get-workflow-jobs.outputs.result).lint}} == 'success'"
|
||||||
with:
|
with:
|
||||||
github-token: ${{ steps.get-app-token.outputs.token }}
|
repo-token: ${{ steps.get-app-token.outputs.token }}
|
||||||
script: |
|
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
||||||
var LABEL_ADD
|
add-labels: "lint:ok"
|
||||||
var LABEL_REMOVE
|
remove-labels: "lint:failed"
|
||||||
if ('${{ fromJSON(steps.get-workflow-jobs.outputs.result).lint}}' == 'success') {
|
|
||||||
LABEL_ADD = 'lint:ok'
|
|
||||||
LABEL_REMOVE = 'lint:failed'
|
|
||||||
} else {
|
|
||||||
LABEL_ADD = 'lint:failed'
|
|
||||||
LABEL_REMOVE = 'lint:ok'
|
|
||||||
}
|
|
||||||
|
|
||||||
await github.issues.addLabels({
|
- name: Label lint failure
|
||||||
issue_number: ${{ steps.source-run-info.outputs.pullRequestNumber }},
|
uses: andymckay/labeler@1.0.3
|
||||||
owner: context.repo.owner,
|
if: "${{ fromJSON(steps.get-workflow-jobs.outputs.result).lint}} == 'failure'"
|
||||||
repo: context.repo.repo,
|
|
||||||
labels: [LABEL_ADD]
|
|
||||||
})
|
|
||||||
await github.issues.removeLabel({
|
|
||||||
issue_number: ${{ steps.source-run-info.outputs.pullRequestNumber }},
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
name: LABEL_REMOVE
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
// Ignore errors that provide the label is not there
|
|
||||||
if (err.status !== 404 && err.status !== 410) {
|
|
||||||
core.error(`Unexpected error status: ${err.status} with message: ${err.message}`);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
- name: "Label install status"
|
|
||||||
uses: actions/github-script@v4
|
|
||||||
with:
|
with:
|
||||||
github-token: ${{ steps.get-app-token.outputs.token }}
|
repo-token: ${{ steps.get-app-token.outputs.token }}
|
||||||
script: |
|
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
||||||
var LABEL_ADD
|
add-labels: "lint:failed"
|
||||||
var LABEL_REMOVE
|
remove-labels: "lint:ok"
|
||||||
if ('${{ fromJSON(steps.get-workflow-jobs.outputs.result).install}}' == 'success') {
|
|
||||||
LABEL_ADD = 'install:ok'
|
|
||||||
LABEL_REMOVE = 'install:failed'
|
|
||||||
} else {
|
|
||||||
LABEL_ADD = 'install:failed'
|
|
||||||
LABEL_REMOVE = 'install:ok'
|
|
||||||
}
|
|
||||||
|
|
||||||
await github.issues.addLabels({
|
- name: Label install success
|
||||||
issue_number: ${{ steps.source-run-info.outputs.pullRequestNumber }},
|
uses: andymckay/labeler@1.0.3
|
||||||
owner: context.repo.owner,
|
if: "${{ fromJSON(steps.get-workflow-jobs.outputs.result).install}} == 'success'"
|
||||||
repo: context.repo.repo,
|
with:
|
||||||
labels: [LABEL_ADD]
|
repo-token: ${{ steps.get-app-token.outputs.token }}
|
||||||
})
|
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
||||||
await github.issues.removeLabel({
|
add-labels: "install:ok"
|
||||||
issue_number: ${{ steps.source-run-info.outputs.pullRequestNumber }},
|
remove-labels: "install:failed"
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
- name: Label install failure
|
||||||
name: LABEL_REMOVE
|
uses: andymckay/labeler@1.0.3
|
||||||
})
|
if: "${{ fromJSON(steps.get-workflow-jobs.outputs.result).install}} == 'failure'"
|
||||||
.catch(err => {
|
with:
|
||||||
// Ignore errors that provide the label is not there
|
repo-token: ${{ steps.get-app-token.outputs.token }}
|
||||||
if (err.status !== 404 && err.status !== 410) {
|
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
|
||||||
core.error(`Unexpected error status: ${err.status} with message: ${err.message}`);
|
add-labels: "install:failed"
|
||||||
throw err;
|
remove-labels: "install:ok"
|
||||||
}
|
|
||||||
});
|
|
||||||
|
Loading…
Reference in New Issue
Block a user