Skip to content

Commit

Permalink
Simplify regex for GitHub Action references
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpuplava committed Mar 15, 2024
1 parent 004e19b commit 05a109a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if ($CalledRepoBaseIncludeList.Count -eq 0)
}
else
{
$CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '.*@(?<ref>[aA-zZ,0-9,-,\.,/,_]*)' })
$CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '.*@(?<ref>[\w\./-]*)' })

$matchedRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse |
Select-String -Pattern $CalledRepoBaseIncludeList
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/set-gha-refs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ inputs:
default: '@()'
description: >
PowerShell string array of additional RegEx patterns to include when searching for branch references that need to
be updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?<ref>[aA-zZ,0-9,-,\.,/,_]*)/.github/'.
The pattern MUST include a regex named capture group (?<ref>[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be
be updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?<ref>[\w\./-]*)/.github/'.
The pattern MUST include a regex named capture group (?<ref>[\w\./-]*) so the captured ref can be
updated correctly. The parameter must be a PowerShell string array.
expected-ref:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag-version-this-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
if: github.event.pusher.name != 'LombiqBot'
uses: Lombiq/GitHub-Actions/.github/workflows/tag-version.yml@issue/OSOE-735
with:
additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?<ref>[aA-zZ,0-9,-,\.,/,_]*)/.github")'
additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?<ref>[\w\./-]*)/.github")'
secrets:
TAG_VERSION_TOKEN: ${{ secrets.LOMBIQBOT_GITHUB_PERSONAL_ACCESS_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ on:
description: >
PowerShell string array of additional RegEx patterns to include when searching for branch references that need
to be updated, e.g.
'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?<ref>[aA-zZ,0-9,-,\.,/,_]*)/.github/'. The pattern
MUST include a regex named capture group (?<ref>[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be updated
'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?<ref>[\w\./-]*)/.github/'. The pattern
MUST include a regex named capture group (?<ref>[\w\./-]*) so the captured ref can be updated
correctly. The parameter must be a PowerShell string array.
type: string
expected-ref:
Expand Down

0 comments on commit 05a109a

Please sign in to comment.