Skip to content

Commit b54b045

Browse files
authored
chore(ci): Upgrade github workflows to non-deprecated runtimes (#297)
* chore(ci): Upgrade github workflows to non-deprecated runtimes * Updating package workflow to run on Pull Request, as a status check, instead of Push trigger * Update package.yml workflow to contain github token necessary for committing PRs * Update codeql actions to v3
1 parent a40f6ea commit b54b045

File tree

3 files changed

+38
-28
lines changed

3 files changed

+38
-28
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-22.04
2424
steps:
2525
- name: validate
26-
uses: actions/github-script@v6
26+
uses: actions/github-script@v7
2727
with:
2828
script: |
2929
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
3434
with:
3535
# We must fetch at least the immediate parents so that if this is
3636
# a pull request then we can checkout the head.
@@ -43,7 +43,7 @@ jobs:
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
46+
uses: github/codeql-action/init@v3
4747
with:
4848
languages: ${{ matrix.language }}
4949
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +54,7 @@ jobs:
5454
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5555
# If this step fails, then you should remove it and run the build manually (see below)
5656
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
57+
uses: github/codeql-action/autobuild@v3
5858

5959
# ℹ️ Command-line programs to run using the OS shell.
6060
# 📚 https://git.io/JvXDl
@@ -68,4 +68,4 @@ jobs:
6868
# make release
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
71+
uses: github/codeql-action/analyze@v3

.github/workflows/package.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1+
# When a pull request is opened/reopened or when the head branch of the pull request is updated.
12
on:
2-
push:
3-
branches:
4-
- master
3+
[pull_request]
54

65
name: Package
76

87
jobs:
98
check:
109
name: Package distribution file
11-
runs-on: ubuntu-22.04
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1213
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
with:
16-
ref: master
17-
- name: Node setup
18-
uses: actions/setup-node@v4
19-
with:
20-
node-version: 20
21-
- name: Package
22-
run: |
23-
npm ci
24-
npm test
25-
npm run package
26-
- name: Commit
27-
run: |
28-
git config --global user.name "GitHub Actions"
29-
git add dist/
30-
git commit -m "chore: Update dist" || echo "No changes to commit"
31-
git push origin HEAD:master
14+
- name: Init a git repo
15+
uses: actions/checkout@v4
16+
- name: Checkout PR
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: gh pr checkout ${{ github.event.pull_request.number }}
20+
- name: Node setup
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
- name: Package
25+
run: |
26+
npm ci
27+
npm test
28+
npm run package
29+
- name: Commit to PR
30+
if: github.actor == 'dependabot[bot]'
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
git config --global user.name "GitHub Actions"
35+
git add dist/
36+
git commit -m "chore: Update dist" || echo "No changes to commit"
37+
git push
38+
- name: Check git diff
39+
if: github.actor != 'dependabot[bot]'
40+
run: |
41+
git diff --exit-code dist/index.js

0 commit comments

Comments
 (0)