-
Notifications
You must be signed in to change notification settings - Fork 324
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
JIRA: Use env when creating with custom fields #1786
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
name: Jira sync | ||
steps: | ||
- name: Login | ||
uses: atlassian/gajira-login@v3 | ||
uses: atlassian/gajira-login@v2.0.0 | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | ||
|
@@ -24,17 +24,38 @@ jobs: | |
- name: Set ticket type | ||
id: set-ticket-type | ||
run: | | ||
echo "::set-output name=type::GH Issue" | ||
if [[ "${{ github.event_name == 'pull_request' && github.event.action == 'opened' ]]; then | ||
echo "::set-output name=type::PR" | ||
else | ||
echo "::set-output name=type::GH Issue" | ||
fi | ||
|
||
- name: Set ticket labels | ||
if: github.event.action == 'opened' | ||
id: set-ticket-labels | ||
run: | | ||
LABELS="[consul-k8s]" | ||
echo "::set-output name=labels::${LABELS}" | ||
|
||
- name: Check if team member | ||
if: github.event.action == 'opened' && steps.set-ticket-type.outputs.type == 'Task' | ||
id: is-team-member | ||
run: | | ||
TEAM=consul | ||
ROLE="$(hub api orgs/hashicorp/teams/${TEAM}/memberships/${{ github.actor }} | jq -r '.role | select(.!=null)')" | ||
if [[ -n ${ROLE} ]]; then | ||
echo "Actor ${{ github.actor }} is a ${TEAM} team member" | ||
echo "::set-output name=message::true" | ||
else | ||
echo "Actor ${{ github.actor }} is NOT a ${TEAM} team member" | ||
echo "::set-output name=message::false" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.JIRA_SYNC_GITHUB_TOKEN }} | ||
|
||
- name: Create ticket | ||
if: ( github.event.action == 'opened' && steps.set-ticket-type.outputs.type != 'Task' ) || ( github.event.action == 'opened' && steps.set-ticket-type.outputs.type == 'Task' ) | ||
uses: tomhjp/gh-action-jira-create@v0.1.3 | ||
- name: Create ticket if an issue is filed, or if PR not by a team member is opened | ||
if: ( github.event.action == 'opened' && steps.set-ticket-type.outputs.type == 'GH Issue' ) || ( github.event.action == 'opened' && steps.set-ticket-type.outputs.type == 'PR' && steps.is-team-member.outputs.message == 'false' ) | ||
uses: tomhjp/gh-action-jira-create@v0.2.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going back to 2.0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I don't think the 0.1.3 made any difference, the issue was Auth was not working when using the action when custom fields were used in JIRA |
||
with: | ||
project: NET | ||
issuetype: "${{ steps.set-ticket-type.outputs.type }}" | ||
|
@@ -45,6 +66,10 @@ jobs: | |
"customfield_10371": { "value": "GitHub" }, | ||
"components": [{ "name": "${{ github.event.repository.name }}" }], | ||
"labels": ${{ steps.set-ticket-labels.outputs.labels }} }' | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | ||
|
||
- name: Search | ||
if: github.event.action != 'opened' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be some kind auth issue so going back to v2.0.0 just in case