Skip to content

Commit 44c5b15

Browse files
committed
Cleanup code style
* phpcs (rules based on @xendk's appocular standard) * phpstan * markdownlint
1 parent aeff844 commit 44c5b15

File tree

7 files changed

+310
-232
lines changed

7 files changed

+310
-232
lines changed

.phpcs.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<file>./src</file>
4+
<file>./tests</file>
5+
<config name="installed_paths" value="../../appocular/coding-standard"/>
6+
<rule ref="AppocularCodingStandard"/>
7+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8+
<properties>
9+
<!-- Tell Slevomat the root directories of our namespaces, so
10+
it can check if the filepath is correct. -->
11+
<property name="rootNamespaces" type="array">
12+
<element key="src" value="GitHubSecurityJira"/>
13+
<element key="tests" value="GitHubSecurityJira"/>
14+
</property>
15+
</properties>
16+
</rule>
17+
</ruleset>

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------
2-
FROM composer:1.9 AS build-env
2+
FROM composer:1.9.1 AS build-env
33

44
COPY . /opt/ghsec-jira/
55

@@ -8,7 +8,7 @@ WORKDIR /opt/ghsec-jira
88
RUN composer install --prefer-dist --no-dev
99

1010
# -----------------
11-
FROM php:7.3.12-alpine
11+
FROM php:7.4.1-alpine
1212

1313
COPY --from=build-env /opt/ghsec-jira/ /opt/ghsec-jira/
1414

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# github-security-jira
2-
GitHub Action for mapping security alerts to Jira tickets.
32

3+
GitHub Action for mapping security alerts to Jira tickets.
44

55
## Setup
66

@@ -9,22 +9,22 @@ You need the following pieces set up to sync alerts with Jira:
99
1. Two repo secrets containing a GitHub access token and a Jira API token, respectively.
1010
2. A workflow file which runs the action on a schedule, continually creating new tickets when necessary.
1111

12-
1312
### Repo secrets
13+
1414
The `reload/github-security-jira` action requires you to [create two encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets#creating-encrypted-secrets) in the repo:
1515

1616
1. A secret called `GitHubSecurityToken` which should contain a [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) for the GitHub user under which this action should be executed. The token must include the `public_repo` scope if checking only public repos, or the `repo` scope for use on private repos. Also, the user must have [access to security alerts in the repo](https://help.github.com/en/github/managing-security-vulnerabilities/managing-alerts-for-vulnerable-dependencies-in-your-organization).
1717
2. A secret called `JiraApiToken` containing an [API Token](https://confluence.atlassian.com/cloud/api-tokens-938839638.html) for the Jira user that should be used to create tickets.
1818

19-
2019
### Workflow file setup
20+
2121
The [GitHub workflow file](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#creating-a-workflow-file) should reside in any repo where you want to sync security alerts with Jira.
2222

2323
It has some required and some optional settings, which are passed to the action as environment variables:
2424

2525
- `GH_SECURITY_TOKEN`: A reference to the repo secret `GitHubSecurityToken` (**REQUIRED**)
2626
- `JIRA_TOKEN`: A reference to the repo secret `JiraApiToken` (**REQUIRED**)
27-
- `JIRA_HOST`: The endpoint for your Jira instance, e.g. https://foo.atlassian.net (**REQUIRED**)
27+
- `JIRA_HOST`: The endpoint for your Jira instance, e.g. <https://foo.atlassian.net> (**REQUIRED**)
2828
- `JIRA_USER`: The ID of the Jira user which is associated with the 'JiraApiToken' secret, eg '[email protected]' (**REQUIRED**)
2929
- `JIRA_PROJECT`: The project key for the Jira project where issues should be created, eg `TEST` or `ABC`. (**REQUIRED**)
3030
- `JIRA_ISSUE_TYPE`: Type of issue to create, e.g. `Security`. Defaults to `Bug`. (*Optional*)
@@ -55,7 +55,6 @@ jobs:
5555
5656
```
5757
58-
5958
## Local development
6059
6160
Copy `docker-composer.override.example.yml` to `docker-composer.override.yml` and edit according to your settings.

composer.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@
1010
"reload/jira-security-issue": "dev-master"
1111
},
1212
"repositories": [
13-
{
14-
"type": "vcs",
15-
"url": "https://github.com/reload/jira-security-issue"
16-
}
13+
{
14+
"type": "vcs",
15+
"url": "https://github.com/appocular/coding-standard"
16+
},
17+
{
18+
"type": "vcs",
19+
"url": "https://github.com/reload/jira-security-issue"
20+
}
1721
],
1822
"autoload": {
1923
"psr-4": {
2024
"GitHubSecurityJira\\": "src/"
2125
}
26+
},
27+
"require-dev": {
28+
"appocular/coding-standard": "^1.0",
29+
"phpstan/phpstan": "^0.12.5"
2230
}
2331
}

0 commit comments

Comments
 (0)