2021-11-29 21:11:15 +00:00
|
|
|
name: Main Checks
|
|
|
|
|
|
|
|
on:
|
2023-03-01 14:02:35 +00:00
|
|
|
workflow_dispatch:
|
2021-11-29 21:11:15 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# Automatically cancel in-progress actions on the same branch
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
congrats:
|
|
|
|
name: congratsbot
|
2021-12-02 20:04:11 +00:00
|
|
|
if: ${{ github.repository_owner == 'withastro' }}
|
2023-06-22 20:42:17 +00:00
|
|
|
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 }}
|
2021-11-29 21:11:15 +00:00
|
|
|
|
|
|
|
check_for_update:
|
|
|
|
name: Check for Updates
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
run_job: ${{ steps.check_files.outputs.run_job }}
|
|
|
|
steps:
|
2022-03-09 16:12:12 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2022-10-28 18:36:50 +00:00
|
|
|
- name: Setup PNPM
|
2023-02-24 15:52:43 +00:00
|
|
|
uses: pnpm/action-setup@v2
|
2022-10-28 18:36:50 +00:00
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 16
|
2023-02-24 15:52:43 +00:00
|
|
|
cache: "pnpm"
|
2022-10-28 18:36:50 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Check Modified
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm exec changeset status --output ./status.json
|
2021-11-29 21:11:15 +00:00
|
|
|
|
|
|
|
- name: Check Output
|
|
|
|
id: check_files
|
2022-03-09 16:12:12 +00:00
|
|
|
run: |
|
2021-11-29 21:11:15 +00:00
|
|
|
output=`echo $(cat status.json)`
|
|
|
|
if [[ $output = '{ "changesets": [], "releases": [] }' ]]
|
|
|
|
then
|
|
|
|
echo 'No changeset found'
|
|
|
|
echo "::set-output name=run_job::true"
|
|
|
|
else
|
|
|
|
echo 'changes found, push to latest skipped'
|
|
|
|
echo "::set-output name=run_job::false"
|
|
|
|
fi
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
update:
|
|
|
|
name: Update the latest branch
|
|
|
|
needs: check_for_update
|
|
|
|
if: needs.check_for_update.outputs.run_job == 'true'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-09 16:12:12 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Push
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
branch: latest
|