Skip to content

Commit

Permalink
Merge pull request #11 from creative-commoners/pulls/main/action-ci-2
Browse files Browse the repository at this point in the history
FIX Update action-ci naming
  • Loading branch information
GuySartorelli authored Aug 16, 2023
2 parents 6234119 + e7e0977 commit 629ec4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
15 changes: 15 additions & 0 deletions funcs_scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ function is_gha_repository()
return strpos($MODULE_DIR, '/gha-') !== false;
}

/**
* Return the module name without the account e.g. silverstripe/silverstripe-admin with return silverstripe-admin
*
* Example usage:
* if (module_name() === 'silverstripe-admin) {
* // logic
* }
*/
function module_name()
{
global $MODULE_DIR;
$parts = explode('/', $MODULE_DIR);
return end($parts);
}

/**
* Determine if the module being processed is one of the modules in a list
*
Expand Down
9 changes: 5 additions & 4 deletions scripts/cms-any/action-ci.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?php

$ci = <<<EOT
name: CI
name: Action CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
ci:
name: CI
actionci:
name: Action CI
uses: silverstripe/gha-action-ci/.github/workflows/action-ci.yml@v1
EOT;

if (is_gha_repository()) {
write_file_even_if_exists('.github/workflows/action-ci.yml', $ci);
$filename = module_name() === 'gha-action-ci' ? 'action-ci-self.yml' : 'action-ci.yml';
write_file_even_if_exists(".github/workflows/$filename", $ci);
}

0 comments on commit 629ec4f

Please sign in to comment.