Skip to content

Commit

Permalink
imp: recebe número da PR como input
Browse files Browse the repository at this point in the history
  • Loading branch information
Euclécio Josias Rodrigues authored and Euclécio Josias Rodrigues committed Feb 1, 2021
1 parent 589615b commit 7e53559
Show file tree
Hide file tree
Showing 5 changed files with 5,945 additions and 36 deletions.
70 changes: 39 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

A GitHub action that evaluates projects with [Stylelint](https://stylelint.io/) and comments the evaluation outcome on the student's pull request.

## Development

**P.S.:** Github actions will run `dist/index.js` to execute this action, so you must to run `npm run pack`if you want apply any changes.

Install the dependencies
```bash
$ npm install
```

Run the tests :heavy_check_mark:
```bash
$ npm test
```

## Package for distribution

GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.

Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.

Run package

```bash
npm run pack
```

Since the packaged index.js is run from the dist folder.

```bash
git add dist
```

## Inputs

This action accepts the following configuration parameters via `with:`
Expand All @@ -10,7 +42,13 @@ This action accepts the following configuration parameters via `with:`

**Required**

The GitHub token to use for making API requests
The GitHub token to use for making API requests.

- `pr_number`

**Required**

Pull Request number that dispatched the workflow.

## Example usage

Expand Down Expand Up @@ -95,36 +133,6 @@ You can use plugins in the configuration file `.stylelintrc.json`. However, bewa

For more information related to configuring `Stylelint` with `.stylelintrc.json`, read its [guide](https://stylelint.io/user-guide/configure#plugins).

## Development

Install the dependencies
```bash
$ npm install
```

Run the tests :heavy_check_mark:
```bash
$ npm test
```

## Package for distribution

GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.

Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.

Run package

```bash
npm run pack
```

Since the packaged index.js is run from the dist folder.

```bash
git add dist
```

## Create a release branch

Users shouldn't consume the action from master since that would be latest code and actions can break compatibility between major versions.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
token:
description: "The GitHub token to use for making API requests"
required: true
pr_number:
description: 'Pull Request number that dispatched the workflow'
required: true
runs:
using: "node12"
main: "dist/index.js"
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ const run = async () => {
const root = process.env.GITHUB_WORKSPACE || process.cwd();
const token = core.getInput('token', { required: true });
const client = github.getOctokit(token);
const { owner, repo, number } = github.context.issue;
const { owner, repo } = github.context.issue;
const npmStatus = runNpm(root);
const { status: stylelintStatus, outcomes: stylelintOutcomes } = runStylelint(root);
const status = npmStatus + stylelintStatus;
Expand All @@ -380,7 +380,7 @@ const run = async () => {
await client.issues.createComment({
owner,
repo,
issue_number: number,
issue_number: process.env.INPUT_PR_NUMBER,
body: feedbackMessage,
});

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const run = async () => {
const root = process.env.GITHUB_WORKSPACE || process.cwd();
const token = core.getInput('token', { required: true });
const client = github.getOctokit(token);
const { owner, repo, number } = github.context.issue;
const { owner, repo } = github.context.issue;
const npmStatus = runNpm(root);
const { status: stylelintStatus, outcomes: stylelintOutcomes } = runStylelint(root);
const status = npmStatus + stylelintStatus;
Expand All @@ -22,7 +22,7 @@ const run = async () => {
await client.issues.createComment({
owner,
repo,
issue_number: number,
issue_number: process.env.INPUT_PR_NUMBER,
body: feedbackMessage,
});

Expand Down
Loading

0 comments on commit 7e53559

Please sign in to comment.