diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 3291ce16e..6b1b0e4ad 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,4 +1,4 @@ -name: "Format Code" +name: Format on: workflow_dispatch: @@ -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: fred+astrobot@astro.build + uses: withastro/automation/.github/workflows/format.yml@main + with: + command: "format:ci" + secrets: inherit diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml deleted file mode 100644 index cc370ea07..000000000 --- a/.github/workflows/issue.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Auto Assign Issues to Project - -on: - issues: - types: [opened] - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - auto_assign_issues: - runs-on: ubuntu-latest - name: Auto-assign new issues to projects - steps: - - name: Assign Bugs to the Bug Tracker - uses: srggrs/assign-one-project-github-action@1.3.1 - if: github.event.action == 'opened' && startsWith(github.event.issue.title, '🐛 BUG:') - with: - project: 'https://github.com/withastro/astro/projects/2' - column_name: 'Needs Triage' - - - name: Assign RFCs to the RFC Tracker - uses: srggrs/assign-one-project-github-action@1.3.1 - if: github.event.action == 'opened' && startsWith(github.event.issue.title, '💡 RFC:') - with: - project: 'https://github.com/withastro/astro/projects/3' - column_name: 'Discussing' - - - name: Assign RFCs to the Docs Tracker - uses: srggrs/assign-one-project-github-action@1.3.1 - if: github.event.action == 'opened' && startsWith(github.event.issue.title, '📘 DOC:') - with: - project: 'https://github.com/withastro/astro/projects/5' - column_name: 'TODO' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8f686c577..0c348f7c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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/action-discord@0.3.2 - with: - args: "**Merged!** ${{ github.event.commits[0].author.name }}: [`${{ steps.setup.outputs.COMMIT_MSG }}`]()" + 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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 027533ef6..2a3bfd194 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,4 +1,4 @@ -name: "Nightly" +name: Nightly on: schedule: @@ -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