Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
tunisiano187 committed Mar 29, 2024
1 parent df0902f commit 794177a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/edited-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Validate issue

on:
issues:
types: [edited]

jobs:
validation:
if: ${{ github.event.issue.state == 'open' }}
runs-on: windows-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/[email protected]
- name: Install needed packages
uses: crazy-max/[email protected]
with:
args: install trid 7zip.portable -y --no-progress
- name: Validate Issue
run: |
Import-Module "${{ github.workspace }}\scripts\edit.psm1"
Exclude-package -title ${{ github.event.issue.title }} -issueNumber ${{ github.event.issue.number }} -repository "${{ github.event.repository.full_name }}"
32 changes: 32 additions & 0 deletions scripts/Exclude-package.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<#
.SYNOPSIS
Updates nuspec file description from README.md
.DESCRIPTION
This script should be called in au_AfterUpdate to put the text in the README.md
into description tag of the Nuspec file. The current description will be replaced.
Function will throw an error if README.md is not found.
.PARAMETER SkipFirst
Number of start lines to skip from the README.md, by default 0.
.PARAMETER SkipLast
Number of end lines to skip from the README.md, by default 0.
.EXAMPLE
function global:au_AfterUpdate { Set-DescriptionFromReadme -SkipFirst 2 }
#>
function Exclude-Package {
param(
[Parameter(Mandatory = $true, ParameterSetName = "issue")]
[long]$issueNumber,
[Parameter(Mandatory = $true)]
[string]$title
)
Write-Host "number : $issueNumber"
Write-Host "Title : $title"
$extract = $($title.split('(|)')[1])
Write-Host "Extract : $extract"
$folder = Join-Path $PSScriptRoot "../automatic/$extract"
Write-Host "Test : $(Test-Path -Path $folder)"
}
19 changes: 19 additions & 0 deletions scripts/edit.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Export all the extensions that are meant to be used
# within a au update script here.

# We just specify the functions we want to export
# but the file containing the functions is expected
# to be named using the same name.
$funcs = @(
'New-GithubIssue'
'Exclude-package'
)

$funcs | % {
if (Test-Path "$PSScriptRoot\$_.ps1") {
. "$PSScriptRoot\$_.ps1"
if (Get-Command $_ -ea 0) {
Export-ModuleMember -Function $_
}
}
}

0 comments on commit 794177a

Please sign in to comment.