Skip to content

Automated Packer Build Halts at Initial Privacy and OOBE Screen for Windows 11 Enterprise Cloud PC SKU #134

Automated Packer Build Halts at Initial Privacy and OOBE Screen for Windows 11 Enterprise Cloud PC SKU

Automated Packer Build Halts at Initial Privacy and OOBE Screen for Windows 11 Enterprise Cloud PC SKU #134

Workflow file for this run

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
name: JIRA Sync
on:
issues:
types: [labeled]
permissions:
contents: read
jobs:
sync:
name: Sync to JIRA
permissions:
issues: write # for actions-ecosytem/action-create-comment
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@45fd029b9f1d6d8926c6f04175aa80c0e42c9026 # v3.0.1
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 == 'labeled'
id: search
uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2
with:
# cf[10089] is Issue Link (use JIRA API to retrieve)
jql: 'project = "HPR" AND cf[10089] = "${{ github.event.issue.html_url }}"'
- name: Set type
id: set-ticket-type
run: |
# Questions are not tracked in JIRA at this time.
if [[ "${{ contains(github.event.issue.labels.*.name, 'question') }}" == "true" ]]; then
echo "type=Invalid" >> "$GITHUB_OUTPUT"
else
# Properly labeled GH issues are assigned the standard "GH Issue" type upon creation.
echo "type=GH Issue" >> "$GITHUB_OUTPUT"
fi
- name: Set labels
id: set-ticket-labels
run: |
if [[ "${{ contains(github.event.issue.labels.*.name, 'bug') }}" == "true" ]]; then
echo "labels=[\"bug\"]" >> "$GITHUB_OUTPUT"
elif [[ "${{ contains(github.event.issue.labels.*.name, 'enhancement') }}" == "true" ]]; then
echo "labels=[\"enhancement\"]" >> "$GITHUB_OUTPUT"
else
echo "labels=[]" >> "$GITHUB_OUTPUT"
fi
- name: Validate ticket
if: steps.set-ticket-type.outputs.type == 'Invalid'
run: |
echo "Questions are not being synced to JIRA at this time."
echo "If the issue is a bug or an enhancement please remove the question label and reapply the 'sync to jira' label."
- name: Create ticket
id: create-ticket
if: steps.search.outputs.issue == '' && github.event.label.name == 'sync to jira' && steps.set-ticket-type.outputs.type != 'Invalid'
uses: atlassian/gajira-create@59e177c4f6451399df5b4911c2211104f171e669 # v3.0.1
with:
project: HPR
issuetype: "${{ steps.set-ticket-type.outputs.type }}"
summary: "${{ github.event.repository.name }}: ${{ github.event.issue.title }}"
description: "${{ github.event.issue.body }}\n\n_Created from GitHub by ${{ github.actor }}._"
# The field customfield_10089 refers to the Issue Link field in JIRA.
fields: '{ "customfield_10089": "${{ github.event.issue.html_url }}",
"components": [{ "name": "Core" }],
"labels": ${{ steps.set-ticket-labels.outputs.labels }} }'
- name: Add tracking comment
if: steps.create-ticket.outputs.issue != '' && steps.set-ticket-type.outputs.type != 'Invalid'
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
This issue has been synced to JIRA for planning.
JIRA ID: [${{ steps.create-ticket.outputs.issue }}](https://hashicorp.atlassian.net/browse/${{steps.create-ticket.outputs.issue}})`
})