Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

[MOVIE]: Gremlins 2: The New Batch (1990) #1165

[MOVIE]: Gremlins 2: The New Batch (1990)

[MOVIE]: Gremlins 2: The New Batch (1990) #1165

Workflow file for this run

---
name: Relabel Issue
on:
issues:
types: [edited]
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number }}
jobs:
relabel_issue:
name: Relabel issue ${{ github.event.issue.number }}
runs-on: ubuntu-latest
steps:
# we want to skip edits made by the bot (especially title edits)
- name: Get Actor
id: get_actor
run: |
echo "actor=${{ github.actor }}" >> $GITHUB_OUTPUT
- name: Relabel issue ${{ github.event.issue.number }}
if: ${{ steps.get_actor.outputs.actor != 'LizardByte-bot' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_BOT_TOKEN }}
script: |
// get labels
const labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
})
// list of labels to permanently remove
const labels_remove = ["approve-theme", "approve-queue", "question"]
// check if labels list contains any of the labels to remove
for (var label_name of labels_remove) {
var label_remove = labels.data.some(label => label.name === label_name)
if (label_remove) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: [label_name]
})
}
}
// check if labels list contains "request-theme"
const request_label = "request-theme"
const label_request = labels.data.some(label => label.name === request_label)
// remove label if label exists
if (label_request) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: [request_label]
})
}
// add a delay to allow the label to be removed before trying to re-add it
await new Promise(r => setTimeout(r, 10000));
// labels to add list
var labels_add = ["edited"]
// add label if it existed before, this will re-trigger another workflow
if (label_request) {
labels_add.push(request_label)
}
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: labels_add
})