Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Update action-ci naming #11

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}