seferov / pr-lint-action Goto Github PK
View Code? Open in Web Editor NEW:octocat: PR lint for GitHub Actions
License: Mozilla Public License 2.0
:octocat: PR lint for GitHub Actions
License: Mozilla Public License 2.0
Please, consider adding such features:
I noticed that the execution time of your action takes around 25 seconds which seems quite a lot for such a simple thing.
In the logs, I found that only the container build process takes 22 seconds. When the actual action execution takes less than a second. See screenshot below.
By using JavaScript action instead of Docker container action you can get rid of those 22 seconds of the build time and speed up your action significantly.
In order to do that you just need to keep one compiled execution file with all the dependencies in your repo. And such a tool like ncc can easily help you with that.
And that's important as my application container build takes almost the same time. I don't talk about the linter which pulls the code, installs all the dependencies, and lints all the code for twice less time than I lint my PR name.
Starting today the action is failing:
24s
Build container for action use: '/home/runner/work/_actions/seferov/pr-lint-action/master/Dockerfile'.
/usr/bin/docker build -t 1e5c35:418297ee28f5419bb5c2beafaaf1d344 -f "/home/runner/work/_actions/seferov/pr-lint-action/master/Dockerfile" "/home/runner/work/_actions/seferov/pr-lint-action/master"
Sending build context to Docker daemon 57.34kB
Step 1/5 : FROM node:slim
slim: Pulling from library/node
babf97a3f00a: Pulling fs layer
d81eb1809d95: Pulling fs layer
54b0718e1fd5: Pulling fs layer
9f80bf52a6c0: Pulling fs layer
28724063fd29: Pulling fs layer
9f80bf52a6c0: Waiting
28724063fd29: Waiting
d81eb1809d95: Verifying Checksum
d81eb1809d95: Download complete
babf97a3f00a: Verifying Checksum
babf97a3f00a: Download complete
9f80bf52a6c0: Verifying Checksum
9f80bf52a6c0: Download complete
54b0718e1fd5: Verifying Checksum
54b0718e1fd5: Download complete
28724063fd29: Verifying Checksum
28724063fd29: Download complete
babf97a3f00a: Pull complete
d81eb1809d95: Pull complete
54b0718e1fd5: Pull complete
9f80bf52a6c0: Pull complete
28724063fd29: Pull complete
Digest: sha256:a39f2854f7fc02c8636c11227ca2d6680bd46a2173168650928b69cc03dffb1c
Status: Downloaded newer image for node:slim
---> 2870b8b46426
Step 2/5 : COPY . .
---> f684f86b568f
Step 3/5 : RUN npm install
---> Running in d2d05012eeca
npm notice
npm notice New patch version of npm available! 7.0.2 -> 7.0.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-22T20_48_13_751Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1
Warning: Docker build failed with exit code 1, back off 7.108 seconds before retry.
/usr/bin/docker build -t 1e5c35:418297ee28f5419bb5c2beafaaf1d344 -f "/home/runner/work/_actions/seferov/pr-lint-action/master/Dockerfile" "/home/runner/work/_actions/seferov/pr-lint-action/master"
Sending build context to Docker daemon 57.34kB
Step 1/5 : FROM node:slim
---> 2870b8b46426
Step 2/5 : COPY . .
---> Using cache
---> f684f86b568f
Step 3/5 : RUN npm install
---> Running in 53b5b5c6cf1a
npm notice
npm notice New patch version of npm available! 7.0.2 -> 7.0.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-22T20_48_22_075Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1
Warning: Docker build failed with exit code 1, back off 5.19 seconds before retry.
/usr/bin/docker build -t 1e5c35:418297ee28f5419bb5c2beafaaf1d344 -f "/home/runner/work/_actions/seferov/pr-lint-action/master/Dockerfile" "/home/runner/work/_actions/seferov/pr-lint-action/master"
Sending build context to Docker daemon 57.34kB
Step 1/5 : FROM node:slim
---> 2870b8b46426
Step 2/5 : COPY . .
---> Using cache
---> f684f86b568f
Step 3/5 : RUN npm install
---> Running in a6025a12c4aa
npm notice
npm notice New patch version of npm available! 7.0.2 -> 7.0.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-22T20_48_28_537Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1
Error: Docker build failed with exit code 1
Not sure if that is code related though.
Extracted from #17
Providing error-message
as an input to this action causes an error/warning:
Unexpected input(s) 'error-message', valid inputs are ['entryPoint', 'args', 'title-regex']
Configuration:
lint:
runs-on: ubuntu-22.04
env:
PR_TITLE: ${{inputs.pr_title}}
steps:
- uses: seferov/pr-lint-action@master
with:
title-regex: '(^(IF|KLUE|KIS)-[0-9]+|^Hotfix-([0-9]+(\/[0-9]+)+))\s--\s[^\n\r]+$'
error-message: 'Expected format:\n(IF|KLUE|KIS)-<Jira Ticket> || Hotfix-2022/03/09 -- short description'
I'm not entirely sure if this is expected behaviour, but I tested the action with a PR that does not match the regex I had put and I get a fail (that is expected)
After editing the name of the PR in github and re runing the checks it looks like the action pulls the unmodified title (which was Add pr lint action
but has been changed to Feature: Add pr lint action
title: Add pr lint action
##[error]Please fix your PR title to match ^Feature:|Fix:|Refactor:
##[error]Docker run failed with exit code 1
Using the optional inputs results in a warning:
Warning: Unexpected input(s) 'title-regex-flags', 'error-message', valid inputs are ['entryPoint', 'args', 'title-regex']
I assume this is because they are not present in the actions.yml file but I am inexperienced with writing github actions.
For some reason (might totally be me) I cannot get this workflow to run, it fails in setup
I can use other workflows fine that do similar things, but this action is the one I'd prefer to use. I tried the manual approach and the GitHub workflow helper UI. Both failed in similar fashion.
I also tried to add the following configuration but it failed in the same way.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Since I'm deleting and testing on a throwaway repo, here's the exact configuration of my workflow for that given failure (with the env
included, though the results are the same without)
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
types: ["opened", "edited", "reopened", "synchronize"]
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
# Runs a PR Linting Action
- name: PR Lint GitHub Action
uses: seferov/[email protected]
with:
# Title regex to match
title-regex: ^\[PROJECT-\d{3,}\] \ # default is ^\[PROJECT-\d*\]\
# ${{ secrets.GITHUB_TOKEN }}
# github-token: # optional
# If set, on a failing job automatically closes pull request and comments on it with the given value
# auto-close-message: # optional
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Some issues were found in GitHub workflow(s).
Please review the annotations and correct the issues.
.github/workflows/pr-lint.yml#L1
data/jobs/pr-lint should have required property 'timeout-minutes'
name: PR Title lint
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
jobs:
pr-lint:
runs-on: ubuntu-latest
steps:
- uses: seferov/pr-lint-action@master
with:
title-regex: '^(build|ci|docs|feat|fix|perf|refactor|style|test):\sTICK-\d{1,4}\s.*'
error-message: 'Please fix the PR title'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.