From 14b625d29eb093b984634a6bba1740679bbfbdc8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 18 Aug 2020 10:17:31 +0100 Subject: [PATCH] GitHub Actions cleanup - only attempted scheduled job on `push` (where secrets are around) - use more Homebrew actions - fix `pull_request: []` warning - use `@main` actions --- .github/workflows/scheduled.yml | 33 ++++++++++++++++++++++----------- .github/workflows/tests.yml | 6 +++--- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index f713206f8..b8f7d376d 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -1,6 +1,6 @@ name: Scheduled regeneration on: - pull_request: + push: paths: - .github/workflows/scheduled.yml schedule: @@ -12,10 +12,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Git repository - uses: actions/checkout@master + uses: actions/checkout@main + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master - name: Set up Ruby - uses: actions/setup-ruby@v1 + uses: actions/setup-ruby@main with: ruby-version: '2.6' @@ -24,18 +31,22 @@ jobs: gem install bundler -v "~>1" bundle install --jobs 4 --retry 3 + - name: Configure Git user + uses: Homebrew/actions/git-user-config@master + with: + username: BrewTestBot + - name: Generate site run: | - git clone --depth=1 https://github.com/Homebrew/brew - bundle exec rake yard build + git checkout -b master - # commit and push generated files - git add docs + ln -s $(brew --repo) brew + bundle exec rake yard build if ! git diff --no-patch --exit-code HEAD -- docs; then - git config --global user.name "BrewTestBot" - git config --global user.email "homebrew-test-bot@lists.sfconservancy.org" + git add docs git commit -m "docs: updates from Homebrew/brew" docs - git pull --rebase origin master - git push fi + + - name: Push commits + uses: Homebrew/actions/git-try-push@master diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 06e958290..0e5bcd355 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,16 +2,16 @@ name: GitHub Actions CI on: push: branches: master - pull_request: [] + pull_request: jobs: tests: runs-on: ubuntu-latest steps: - name: Set up Git repository - uses: actions/checkout@master + uses: actions/checkout@main - name: Set up Ruby - uses: actions/setup-ruby@v1 + uses: actions/setup-ruby@main with: ruby-version: '2.6'