Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generic label swap action #41

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/replace-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# **what?**
# An easy action that automated swapping out one label on an issue for another label

# **why?**
# At the time of writing, this is specifically to help with team triage issue tracking
# but could be used for any label switching need

# **when?**
# When you need to automate switching our issue labels.

# Example:
# name: Update Triage Label

# on: issue_comment

# defaults:
# run:
# shell: bash

# permissions:
# issues: write

# jobs:
# triage_label:
# uses: dbt-labs/actions/.github/workflows/triage-labels.yml@main
# secrets: inherit


name: Replace Issue Label

on:
workflow_call:
inputs:
original_label:
description: The label to check for and replace with new_label
type: string
default: "awaiting_response"
required: true
new_label:
description: The label to replace original_label with
type: string
default: "triage"
required: true

defaults:
run:
shell: bash

permissions:
issues: write

jobs:
triage_label:
if: contains(github.event.issue.labels.*.name, inputs.original_label)
runs-on: ubuntu-latest

steps:
- name: "[DEBUG] - Print Inputs"
shell: bash
id: echo_inputs
run: |
echo "all variables defined as inputs"
echo "original_label: ${{ inputs.original_label }}"
echo "new_label: ${{ inputs.new_label }}"

- name: switch labels
id: switch_labels
run: |
gh issue edit ${{ github.event.issue.number }} --add-label ${{ inputs.new_label }} --remove-label ${{ inputs.original_label }}