Skip to content

Commit b69574f

Browse files
committed
ci(label-actions): actions can't directly access secrets
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
1 parent 7cbdb80 commit b69574f

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

.github/actions/add-labels/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: adds label(s) to labelable
33
inputs:
44
gh_token:
55
description: gh api access token to use
6-
default: ${{ secrets.GITHUB_TOKEN }}
6+
required: true
77
repository:
88
description: the OWNER/REPOSITORY to operate on
99
default: ${{ github.repository }}
@@ -116,7 +116,7 @@ runs:
116116
env:
117117
GH_TOKEN: ${{ inputs.gh_token }}
118118
REPOSITORY: ${{ inputs.repository }}
119-
ISSUES: ${{ inputs.labels }}
119+
ISSUES: ${{ inputs.issues }}
120120
run: |
121121
owner=$(echo "$REPOSITORY" | cut -d '/' -f 1)
122122
repo=$(echo "$REPOSITORY" | cut -d '/' -f 2)
@@ -164,7 +164,7 @@ runs:
164164
env:
165165
GH_TOKEN: ${{ inputs.gh_token }}
166166
REPO_ID: ${{ steps.collect_labels.outputs.repo_id }}
167-
LABELS: ${{ steps.collect_labels.outputs.labels }}
167+
EXISTING: ${{ steps.collect_labels.outputs.found }}
168168
MISSING: ${{ steps.collect_labels.outputs.missing }}
169169
run: |
170170
query=$(
@@ -197,7 +197,7 @@ runs:
197197
)
198198
data=$(
199199
gh api graphql -f query="$query" \
200-
| jq --argjson existing "$LABELS" \
200+
| jq --argjson existing "$EXISTING" \
201201
'
202202
reduce .data[].label as $i ({}; .[$i.name] = {"id": $i.id, "color": $i.color })
203203
| . + $existing

.github/actions/delete-labels/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: delete Label(s)
33
inputs:
44
gh_token:
55
description: gh api access token to use
6-
default: ${{ secrets.GITHUB_TOKEN }}
6+
required: true
77
repository:
88
description: the OWNER/REPOSITORY to operate on
99
default: ${{ github.repository }}
@@ -66,10 +66,10 @@ runs:
6666
| select( objects | .name as $name | any($labels[]; . == $name ) )
6767
) as $i ({}; .[$i.name] = {"id": $i.id})
6868
) as $found
69-
| [.[].id]
69+
| [$found[].id]
7070
'
7171
)
72-
echo "label_ids=$data" >>> "$GITHUB_OUTPUT"
72+
echo "label_ids=$data" >> "$GITHUB_OUTPUT"
7373
7474
- name: Delete Labels
7575
id: delete_labels

.github/workflows/manual-add-label.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Manual workflow to apply labels in bulk
1+
name: Apply labels in bulk
22

33
on:
44
workflow_dispatch:
@@ -38,6 +38,7 @@ jobs:
3838
- name: Run Label Action
3939
uses: ./.github/actions/add-labels
4040
with:
41+
gh_token: ${{ secrets.GITHUB_TOKEN }}
4142
issues: ${{ inputs.issues }}
4243
labels: ${{ inputs.labels }}
4344
colors: ${{ inputs.colors }}

.github/workflows/manual-delete-labels.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
name: Manual workflow to delete labels in bulk
2+
name: Delete labels in bulk
33

44
on:
55
workflow_dispatch:
@@ -26,4 +26,5 @@ jobs:
2626
- name: Run Label Action
2727
uses: ./.github/actions/delete-labels
2828
with:
29+
gh_token: ${{ secrets.GITHUB_TOKEN }}
2930
labels: ${{ inputs.labels }}

0 commit comments

Comments
 (0)