Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
feat(action-composer): Run action through composer registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Nybroe authored Mar 6, 2020
2 parents 49c751b + 4b862db commit dd0bb01
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'PHP Insights App Internal'
description: '(internal) PHP Insights App integration with GitHub actions'
branding:
icon: 'check-square'
color: 'green'
runs:
using: 'docker'
image: '../../action/Dockerfile'
11 changes: 10 additions & 1 deletion .github/workflows/action-docker-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@ on:
- master
paths:
- 'action/*'
schedule:
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Publish to Registry
- name: Publish to GitHub Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: worksome/phpinsights-app/phpinsights-app-action
username: olivernybroe
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
workdir: action
- name: Publish to Docker Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: worksome/phpinsights-app-action
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: action
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: PHP Insights App
uses: ./ # Uses an action in the root directory
uses: ./.github/actions/ # Uses an action in the root directory
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
workingDir: 'action'
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ branding:
color: 'green'
runs:
using: 'docker'
image: 'action/Dockerfile'
image: 'docker://worksome/phpinsights-app-action:latest'
11 changes: 3 additions & 8 deletions action/bin/phpinsights-app.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,9 @@
$configurationDefinition = $container->extend(Configuration::class);
$configurationDefinition->setConcrete($configuration);

dump(GitHubContext::getRuntimeUrl(), GitHubContext::getWorkFlowRunId(), str_split(GitHubContext::getRuntimeToken(), 1500));
$token = GitHubContext::getGitHubToken();
dump(str_split($token, round(strlen($token) / 2)));
dump([
'ref' => getenv('GITHUB_REF'),
'head_ref' => getenv('GITHUB_HEAD_REF'),
'base_ref' => getenv('GITHUB_BASE_REF'),
]);
//dump(GitHubContext::getRuntimeUrl(), GitHubContext::getWorkFlowRunId(), str_split(GitHubContext::getRuntimeToken(), 1500));
//$token = GitHubContext::getGitHubToken();
//dump(str_split($token, round(strlen($token) / 2)));

/** @var Analyser $analyser */
$analyser = $container->get(Analyser::class);
Expand Down
2 changes: 1 addition & 1 deletion action/src/Actions/CreateReviewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function handle(InsightCollection $insightCollection): void
private static function getDescription(Results $results, string $reviewStatus): string
{
$table = sprintf(
"| code | Complexity | Architecture | Style |\n|:-:|:-:|:-:|:-:|\n|%s%%|%s%%|%s%%|%s%%|",
"| Code | Complexity | Architecture | Style |\n|:-:|:-:|:-:|:-:|\n|%s%%|%s%%|%s%%|%s%%|",
$results->getCodeQuality(),
$results->getComplexity(),
$results->getStructure(),
Expand Down

0 comments on commit dd0bb01

Please sign in to comment.