main.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Main Checks
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - main
  7. env:
  8. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  9. # Automatically cancel in-progress actions on the same branch
  10. concurrency:
  11. group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
  12. cancel-in-progress: true
  13. jobs:
  14. congrats:
  15. name: congratsbot
  16. if: ${{ github.repository_owner == 'withastro' && github.event.head_commit.message != '[ci] format' }}
  17. uses: withastro/automation/.github/workflows/congratsbot.yml@main
  18. with:
  19. EMOJIS: '🎉,🎊,🧑‍🚀,🥳,🙌,🚀,👏,<:houston_golden:1068575433647456447>,<:astrocoin:894990669515489301>,<:astro_pride:1130501345326157854>'
  20. secrets:
  21. DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_CONGRATS }}
  22. check_for_update:
  23. name: Check for Updates
  24. runs-on: ubuntu-latest
  25. outputs:
  26. run_job: ${{ steps.check_files.outputs.run_job }}
  27. steps:
  28. - uses: actions/checkout@v4
  29. - name: Setup PNPM
  30. uses: pnpm/action-setup@v2
  31. - name: Setup Node
  32. uses: actions/setup-node@v4
  33. with:
  34. node-version: 18
  35. cache: "pnpm"
  36. - name: Install dependencies
  37. run: pnpm install
  38. - name: Check Modified
  39. run: pnpm exec changeset status --output ./status.json
  40. - name: Check Output
  41. id: check_files
  42. run: |
  43. output=`echo $(cat status.json)`
  44. if [[ $output = '{ "changesets": [], "releases": [] }' ]]
  45. then
  46. echo 'No changeset found'
  47. echo "run_job=true" >> $GITHUB_OUTPUT
  48. else
  49. echo 'changes found, push to latest skipped'
  50. echo "run_job=false" >> $GITHUB_OUTPUT
  51. fi
  52. update:
  53. name: Update the latest branch
  54. needs: check_for_update
  55. if: needs.check_for_update.outputs.run_job == 'true'
  56. runs-on: ubuntu-latest
  57. steps:
  58. - uses: actions/checkout@v4
  59. with:
  60. fetch-depth: 0
  61. - name: Push
  62. uses: ad-m/github-push-action@master
  63. with:
  64. github_token: ${{ secrets.GITHUB_TOKEN }}
  65. branch: latest