Skip to content

Commit

Permalink
Cleanup GitHub Actions (#7451)
Browse files Browse the repository at this point in the history
* chore(ci): cleanup GitHub Actions

* Update .github/workflows/format.yml
  • Loading branch information
natemoo-re authored Jun 22, 2023
1 parent 56d04e4 commit 8642912
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 151 deletions.
36 changes: 6 additions & 30 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Format Code"
name: Format

on:
workflow_dispatch:
Expand All @@ -7,33 +7,9 @@ on:
- main

jobs:
format:
prettier:
if: github.repository_owner == 'withastro'
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- name: Check out code using Git
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Needs access to push to main
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
- name: Setup PNPM
uses: pnpm/action-setup@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Format code
run: pnpm run format:ci
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[ci] format"
branch: ${{ github.head_ref }}
commit_user_name: fredkbot
commit_user_email: [email protected]
uses: withastro/automation/.github/workflows/format.yml@main
with:
command: "format:ci"
secrets: inherit
34 changes: 0 additions & 34 deletions .github/workflows/issue.yml

This file was deleted.

23 changes: 8 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@ jobs:
congrats:
name: congratsbot
if: ${{ github.repository_owner == 'withastro' }}
runs-on: ubuntu-latest
steps:
- id: setup
env:
MESSAGE: ${{ github.event.commits[0].message }}
run: |
TRIMMED=$(echo "$MESSAGE" | sed '1!d;q')
echo "::set-output name=COMMIT_MSG::${TRIMMED}"
- name: Send a Discord notification when a PR is merged
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_CONGRATS }}
# DISCORD_AVATAR: ${{ github.event.pull_request.user.avatar_url }}
uses: Ilshidur/[email protected]
with:
args: "**Merged!** ${{ github.event.commits[0].author.name }}: [`${{ steps.setup.outputs.COMMIT_MSG }}`](<https://github.com/withastro/astro/commit/${{ github.event.commits[0].id }}>)"
uses: withastro/automation/.github/workflows/congratsbot.yml@main
with:
GITHUB_REPO: ${{ github.repository }}
COMMIT_AUTHOR: ${{ github.event.commits[0].author.name }}
COMMIT_MESSAGE: ${{ github.event.commits[0].message }}
COMMIT_ID: ${{ github.event.commits[0].id }}
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_CONGRATS }}

check_for_update:
name: Check for Updates
Expand Down
75 changes: 3 additions & 72 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Nightly"
name: Nightly

on:
schedule:
Expand All @@ -7,76 +7,7 @@ on:
workflow_dispatch:

jobs:
stat:
# Temporarily disable since stat collection hasn't work for a while
if: false
runs-on: ubuntu-latest
steps:
- name: Check out code using Git
uses: actions/checkout@v3

- name: Setup PNPM
uses: pnpm/action-setup@v2

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Collect stats
run: node scripts/stats/index.js
env:
# Needs access to collect stats from the GitHub API
GITHUB_TOKEN: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[ci] collect stats"
branch: ${{ github.head_ref }}
# Needs access to push to main
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}

lockfile:
if: github.repository_owner == 'withastro'
runs-on: ubuntu-latest
steps:
- name: Check out code using Git
uses: actions/checkout@v3

- name: Setup PNPM
uses: pnpm/action-setup@v2

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"

- name: Delete the existing pnpm-lock.yaml file
run: rm pnpm-lock.yaml

# https://github.com/pnpm/pnpm/issues/6463
- name: Update .npmrc to update packages to latest
run: echo "resolution-mode=highest" >> .npmrc

- name: Create a fresh pnpm lockfile (no install)
run: pnpm install --lockfile-only

- name: Create Pull Request
id: createpr
uses: peter-evans/create-pull-request@v5
with:
branch: ci/lockfile
# Access token is needed to trigger CI on this PR
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
commit-message: "[ci] update lockfile"
add-paths: pnpm-lock.yaml
title: "[ci] update lockfile"
body: >
This PR is auto-generated by a nightly GitHub action.
It should automatically be merged if tests pass.
uses: withastro/automation/.github/workflows/lockfile.yml@main
secrets: inherit

0 comments on commit 8642912

Please sign in to comment.