Skip to content

Commit

Permalink
chore(ci): Upgrade github workflows to non-deprecated runtimes (#297)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
amazreech committed May 10, 2024
1 parent a40f6ea commit b54b045
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: validate
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

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

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

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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
56 changes: 33 additions & 23 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
# When a pull request is opened/reopened or when the head branch of the pull request is updated.
on:
push:
branches:
- master
[pull_request]

name: Package

jobs:
check:
name: Package distribution file
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: master
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: 20
- name: Package
run: |
npm ci
npm test
npm run package
- name: Commit
run: |
git config --global user.name "GitHub Actions"
git add dist/
git commit -m "chore: Update dist" || echo "No changes to commit"
git push origin HEAD:master
- name: Init a git repo
uses: actions/checkout@v4
- name: Checkout PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: 20
- name: Package
run: |
npm ci
npm test
npm run package
- name: Commit to PR
if: github.actor == 'dependabot[bot]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git add dist/
git commit -m "chore: Update dist" || echo "No changes to commit"
git push
- name: Check git diff
if: github.actor != 'dependabot[bot]'
run: |
git diff --exit-code dist/index.js

0 comments on commit b54b045

Please sign in to comment.