Skip to content

Modernize

Modernize #178

Workflow file for this run

name: Pull Request Events
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test-check:
name: Lint and check types
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: 📦 Setup PNPM
uses: pnpm/action-setup@v4
with:
version: latest
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: pnpm
- name: 📥 Download dependencies
run: pnpm install
- name: 🧵 Lint
run: pnpm run lint
- name: 🧪 Check types
run: pnpm run check
test-unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: 📦 Setup PNPM
uses: pnpm/action-setup@v4
with:
version: latest
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: pnpm
- name: 📥 Download dependencies
run: pnpm install
- name: 🧪 Run tests
run: pnpm test
build:
name: Commit Release Assets
runs-on: ubuntu-latest
if: ${{ github.event.sender.login == 'ugrc-release-bot[bot]' }}
permissions:
contents: write
steps:
- name: 🪙 Convert token
uses: actions/create-github-app-token@v2
id: generate_token
with:
app-id: ${{ secrets.UGRC_RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.UGRC_RELEASE_BOT_APP_KEY }}
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: 📦 Setup PNPM
uses: pnpm/action-setup@v4
with:
version: latest
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: pnpm
- name: 📥 Download dependencies
run: pnpm install
- name: 🏗️ Build release assets
run: pnpm run build
- name: 🏗️ Commit and push if needed
run: |
git config user.name "${{ secrets.UGRC_RELEASE_BOT_NAME }}"
git config user.email "${{ secrets.UGRC_RELEASE_BOT_EMAIL }}"
git add dist/*
if [ -z "$(git status --porcelain)" ]; then
echo "no changes to dist/*"
exit 0
fi
git commit -m 'chore: build release assets'
git push
integration-test:
name: Integration test
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: 🪙 Convert token
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.UGRC_RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.UGRC_RELEASE_BOT_APP_KEY }}
- name: Check if branch exists
id: check-branch-exists
run: |
if [[ -n $(git ls-remote --heads ${{ github.server_url }}/${{ github.repository }} dev) ]]; then
echo "exists=yes" >> $GITHUB_OUTPUT
else
echo "exists=no" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Create comment
if: ${{ steps.check-branch-exists.outputs.exists == 'yes' }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
/remind me to verify that this works in 1 minute
> [!WARNING]
> This is a test of the dev branch.
token: ${{ steps.generate-token.outputs.token }}