-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38e6471
commit f48ce35
Showing
4 changed files
with
141 additions
and
109 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Add Issue To Project | ||
|
||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
org-name: | ||
description: The name of the organization that owns the project. | ||
required: true | ||
type: string | ||
org-project-name: | ||
description: The name of the organization project to add the issue to. | ||
required: true | ||
type: string | ||
repo-name: | ||
required: true | ||
description: "The name of the C# project to validate." | ||
type: string | ||
item-number: | ||
required: true | ||
description: "The issue or pr number of the item to add to the project." | ||
type: string | ||
secrets: | ||
cicd-pat: | ||
description: The CICD personal access token. | ||
required: true | ||
|
||
|
||
jobs: | ||
add_issue_to_project: | ||
name: Add Item To Project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Print Environment Variables | ||
run: Get-ChildItem -Path Env:* | Sort-Object Name | ||
|
||
- name: Validate Workflow Inputs | ||
run: | | ||
if ("${{ inputs.org-name }}" -eq "") { | ||
Write-Host ":error::The 'org-name' workflow input cannot be empty."; | ||
exit 1; | ||
} | ||
if ("${{ inputs.org-project-name }}" -eq "") { | ||
Write-Host ":error::The 'org-project-name' workflow input cannot be empty."; | ||
exit 1; | ||
} | ||
if ("${{ inputs.repo-name }}" -eq "") { | ||
Write-Host ":error::The 'repo-name' workflow input cannot be empty."; | ||
exit 1; | ||
} | ||
if ("${{ inputs.item-number }}" -eq "") { | ||
Write-Host ":error::The 'item-number' workflow input cannot be empty."; | ||
exit 1; | ||
} | ||
- name: Set Up Deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x | ||
|
||
- name: Add To Project | ||
run: | | ||
# Construct the URL to the organizations CICD scripts | ||
$scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH }}"; | ||
$scriptUrl = $scriptUrl.Replace("\", "/"); | ||
$scriptUrl = $scriptUrl.EndsWith("/") ? $scriptUrl.Substring(0, $scriptUrl.Length - 1) : $scriptUrl; | ||
$scriptUrl = "$scriptUrl/add-item-to-project.ts"; | ||
Write-Host "::notice::NuGet Package Check Script URL: $scriptUrl"; | ||
<# Deno Args: | ||
1. Organization name | ||
2. Project name | ||
3. Repo name | ||
4. Issue or PR number | ||
5. PAT | ||
#> | ||
deno run ` | ||
--allow-net ` | ||
"$scriptUrl" ` | ||
"${{ inputs.org-name }}" ` | ||
"${{ inputs.org-project-name }}" ` | ||
"${{ inputs.repo-name }}" ` | ||
"${{ inputs.item-number }}" ` | ||
"${{ secrets.cicd-pat }}"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 🤖Add New Issue To Project | ||
|
||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
|
||
on: | ||
issues: | ||
types: opened | ||
pull_request: | ||
types: opened | ||
branches: main | ||
|
||
|
||
jobs: | ||
item_number: | ||
name: Get Item Number | ||
runs-on: ubuntu-latest | ||
outputs: | ||
item-number: ${{ steps.get-item-number.outputs.item-number }} | ||
steps: | ||
- name: Get Item Number | ||
id: get-item-number | ||
run: | | ||
$eventName = "${{ github.event_name }}"; | ||
$itemNumber = $eventName -eq "issues" ? "${{ github.event.issue.number }}" : "${{ github.event.pull_request.number }}"; | ||
$itemType = $eventName -eq "issues" ? "issue" : "pull request"; | ||
Write-Host "::notice::Invoked by $itemType '$itemNumber'"; | ||
"item-number=$itemNumber" >> $env:GITHUB_OUTPUT; | ||
add_new_issue_to_project: | ||
name: Add New Issue | ||
needs: item_number | ||
uses: KinsonDigital/Infrastructure/.github/workflows/[email protected] | ||
with: | ||
org-name: "${{ vars.ORGANIZATION_NAME }}" | ||
org-project-name: "${{ vars.ORG_PROJECT_NAME }}" | ||
repo-name: "${{ vars.PROJECT_NAME }}" | ||
item-number: "${{ needs.item_number.outputs.item-number }}" | ||
secrets: | ||
cicd-pat: ${{ secrets.CICD_TOKEN }} |