Skip to content

Commit cc7aeeb

Browse files
committed
use authorization header if available
1 parent 3bcb0af commit cc7aeeb

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.github/workflows/example.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ jobs:
1515
JIRA_COMPONENT: ${{ secrets.JIRA_COMPONENT }}
1616
JIRA_PROJECT_KEY: ${{ secrets.JIRA_PROJECT_KEY }}
1717
JIRA_EPIC_KEY: ${{ secrets.JIRA_EPIC_KEY }}
18+
JIRA_AUTHORIZATION: ${{ secrets.JIRA_AUTHORIZATION }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
JIRA_PROJECT_KEY: ${{ secrets.JIRA_PROJECT_KEY }}
2222
JIRA_EPIC_KEY: ${{ secrets.JIRA_EPIC_KEY }}
2323
```
24+
Alternatively, one can provide the `JIRA_AUTHORIZATION` variable instead of `JIRA_USERNAME` and `JIRA_API_TOKEN`.
25+
2426

2527
## Debug
2628

action.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,16 @@ runs:
126126
env:
127127
JIRA_USERNAME: '${{ inputs.JIRA_USERNAME }}'
128128
JIRA_API_TOKEN: '${{ inputs.JIRA_API_TOKEN }}'
129+
JIRA_AUTHORIZATION: '${{ inputs.JIRA_AUTHORIZATION }}'
129130
run: |
130131
set -eu
131-
132-
jira_auth=$(echo -n "${JIRA_USERNAME}:${JIRA_API_TOKEN}" | base64 | tr -d '\n')
132+
133+
if [ -z "$JIRA_AUTHORIZATION" ]; then
134+
jira_auth=$(echo -n "${JIRA_USERNAME}:${JIRA_API_TOKEN}" | base64 | tr -d '\n')
135+
else
136+
jira_auth="${JIRA_AUTHORIZATION}"
137+
fi
138+
133139
jira_auth_header="Authorization: Basic $jira_auth"
134140
135141
echo "Creating issue ${{ github.event.issue.title }} and linking it as a dependency to ${{ inputs.DEPENDENT_ISSUE }}"

0 commit comments

Comments
 (0)