Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/git-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
pr_title: "[GIT-COMMIT]: Use glob pattern ${{ github.repository }}"
pr_create: true
pr_base: 'master'

pr_labels: "bug,documentation,good first issue"
4 changes: 2 additions & 2 deletions .github/workflows/git-copy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
pr_create: true
pr_base: 'master'
pr_title: "[GIT-COPY]: One file ${{ github.repository }}"
labels: "bug documentation"
pr_labels: "bug,documentation"

- name: Push specific folder
uses: ./git-copy
Expand All @@ -49,7 +49,7 @@ jobs:
pr_create: true
pr_base: 'master'
pr_title: "[GIT-COPY]: Folder ${{ github.repository }}"
labels: "invalid"
pr_labels: "invalid"

- name: Push multiple files
uses: ./git-copy
Expand Down
6 changes: 3 additions & 3 deletions git-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ inputs:
description: 'Create pull request again specific base. Defaults to master branch'
required: false
default: 'master'
labels:
description: 'Mark PR with specific labels. Multiple labels separate with space'
pr_labels:
description: 'Mark PR with specific labels. Multiple labels separated by comma'
required: false
default: ''
runs:
Expand All @@ -46,7 +46,7 @@ runs:
- ${{ inputs.pr-title }}
- ${{ inputs.pr-description }}
- ${{ inputs.pr-base }}
- ${{ inputs.labels }}
- ${{ inputs.pr-labels }}
branding:
icon: 'git-commit'
color: 'green'
28 changes: 15 additions & 13 deletions git-commit/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,30 @@ then
PR_URL=$(jq -r '.html_url' response.json)
PR_ID=$(jq -r '.number' response.json)

IFS=' '
IFS=','
LABELS=""
# Loop over the input labels
for LABEL in $INPUT_LABELS; do
for LABEL in $INPUT_PR_LABELS; do
if [ -z "$LABELS" ]; then
LABELS="\"$LABEL\"" # First label, no comma
else
LABELS="$LABELS, \"$LABEL\"" # Subsequent labels, add a comma
fi
done

# Wrap the labels in square brackets and prepare the JSON payload
LABELS_JSON="{\"labels\":[$LABELS]}"

curl \
-L \
--connect-timeout 10 \
-u "$INPUT_USER_NAME}:$API_TOKEN_GITHUB" \
-X POST \
-H "Accept: application/vnd.github+json" \
-d "$LABELS_JSON" \
"https://api.github.com/repos/$INPUT_REPOSITORY/issues/$PR_ID/labels"
if [ -n "$LABELS" ]; then
# Wrap the labels in square brackets and prepare the JSON payload
LABELS_JSON="{\"labels\":[$LABELS]}"

curl \
-L \
--connect-timeout 10 \
-u "$INPUT_USER_NAME}:$API_TOKEN_GITHUB" \
-X POST \
-H "Accept: application/vnd.github+json" \
-d "$LABELS_JSON" \
"https://api.github.com/repos/$INPUT_REPOSITORY/issues/$PR_ID/labels"
fi

echo "$PR_URL" >> $GITHUB_STEP_SUMMARY
exit 0
Expand Down
6 changes: 3 additions & 3 deletions git-copy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ inputs:
description: 'Create pull request again specific base. Defaults to master branch'
required: false
default: 'master'
labels:
description: 'Mark PR with specific labels. Multiple labels separate with space'
pr_labels:
description: 'Mark PR with specific labels. Multiple labels separated by comma'
required: false
default: ''
runs:
Expand All @@ -54,7 +54,7 @@ runs:
- ${{ inputs.pr-title }}
- ${{ inputs.pr-description }}
- ${{ inputs.pr-base }}
- ${{ inputs.labels }}
- ${{ inputs.pr_labels }}
branding:
icon: 'git-commit'
color: 'green'
28 changes: 15 additions & 13 deletions git-copy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,30 @@ then
PR_URL=$(jq -r '.html_url' response.json)
PR_ID=$(jq -r '.number' response.json)

IFS=' '
IFS=','
LABELS=""
# Loop over the input labels
for LABEL in $INPUT_LABELS; do
for LABEL in $INPUT_PR_LABELS; do
if [ -z "$LABELS" ]; then
LABELS="\"$LABEL\"" # First label, no comma
else
LABELS="$LABELS, \"$LABEL\"" # Subsequent labels, add a comma
fi
done

# Wrap the labels in square brackets and prepare the JSON payload
LABELS_JSON="{\"labels\":[$LABELS]}"

curl \
-L \
--connect-timeout 10 \
-u "$INPUT_USER_NAME}:$API_TOKEN_GITHUB" \
-X POST \
-H "Accept: application/vnd.github+json" \
-d "$LABELS_JSON" \
"https://api.github.com/repos/$INPUT_REPOSITORY/issues/$PR_ID/labels"
if [ -n "$LABELS" ]; then
# Wrap the labels in square brackets and prepare the JSON payload
LABELS_JSON="{\"labels\":[$LABELS]}"

curl \
-L \
--connect-timeout 10 \
-u "$INPUT_USER_NAME}:$API_TOKEN_GITHUB" \
-X POST \
-H "Accept: application/vnd.github+json" \
-d "$LABELS_JSON" \
"https://api.github.com/repos/$INPUT_REPOSITORY/issues/$PR_ID/labels"
fi

echo "$PR_URL" >> $GITHUB_STEP_SUMMARY
exit 0
Expand Down