Skip to content

Commit 4561124

Browse files
Michael Havey - FitzgeraldMichael Havey - Fitzgerald
authored andcommitted
chore: update github workflows
1 parent 9dceb9e commit 4561124

File tree

2 files changed

+66
-4
lines changed

2 files changed

+66
-4
lines changed

.github/workflows/lint.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Lint all branches but master
2+
#
3+
# 1. lint the project
4+
# 2. commit any fixes
5+
# 3. push the changes
6+
#
7+
# It relies on the `GITHUB_TOKEN` secret being available in this repo (available by default)
8+
9+
name: lint
10+
11+
on:
12+
push:
13+
branches-ignore:
14+
- master
15+
16+
jobs:
17+
lint-and-commit:
18+
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
node-version: [10.x]
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
33+
- name: Install and Lint
34+
run: |
35+
npm ci
36+
npm run lint --fix
37+
38+
- name: Commit changes
39+
run: |
40+
git config --local user.email "action@github.com"
41+
git config --local user.name "GitHub Action"
42+
git diff-index --quiet HEAD || git commit -m "automated linting fix-ups" -a
43+
44+
45+
- name: Extract branch name
46+
shell: bash
47+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
48+
id: extract_branch
49+
50+
- name: Ensure we have latest changes
51+
run: |
52+
git rebase origin/${{ steps.extract_branch.outputs.branch }}
53+
git pull
54+
git fetch
55+
56+
- name: Push changes
57+
uses: ad-m/github-push-action@master
58+
with:
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
60+
branch: ${{ steps.extract_branch.outputs.branch }}

.github/workflows/publish.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
with:
3232
node-version: ${{ matrix.node-version }}
3333

34+
- name: Set up git credentials
35+
run: |
36+
git config --local user.email "action@github.com"
37+
git config --local user.name "GitHub Action"
38+
3439
- name: Increment project version
3540
run: npm version patch
3641

@@ -40,10 +45,7 @@ jobs:
4045
npm run build
4146
4247
- name: Commit changes
43-
run: |
44-
git config --local user.email "action@github.com"
45-
git config --local user.name "GitHub Action"
46-
git commit -m "increment package version" -a
48+
run: git commit -m "increment package version" -a
4749

4850
- name: Push changes
4951
uses: ad-m/github-push-action@master

0 commit comments

Comments
 (0)