From d1b07be3ebfd5fc2e301dcb10f1ffb7d45ddda14 Mon Sep 17 00:00:00 2001 From: Matthew Pope <81593196+popematt@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:25:15 -0700 Subject: [PATCH] Make release news workflow trigger the deploy workflow (#340) --- .github/workflows/deploy.yml | 2 ++ .github/workflows/release-news.yml | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9d7a9f2..3093977 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,8 @@ permissions: pages: write on: + # Allow manual starting of this workflow, including using `gh workflow run` in the release news workflow + workflow_dispatch: push: branches: [ gh-pages ] diff --git a/.github/workflows/release-news.yml b/.github/workflows/release-news.yml index 2418ef2..19b4bac 100644 --- a/.github/workflows/release-news.yml +++ b/.github/workflows/release-news.yml @@ -18,11 +18,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - # This is needed so that the deploy workflow will be triggered for news release commits. - # See https://github.com/orgs/community/discussions/26220 - persist-credentials: false - - name: Generate News Posts id: generate_news shell: bash @@ -38,3 +33,14 @@ jobs: git config user.email github-actions@github.com git commit -m "${{ steps.generate_news.outputs.generated_commit_message }}" git push + + - name: Deploy Changes + if: ${{ steps.generate_news.outputs.changes > 0 }} + # If you use the GITHUB_TOKEN to push code, it won't trigger any on-push + # workflows, so we manually the workflow here. + # We can't just call the workflow directly because we need the workflow to run + # on the new commit, not the GITHUB_REF for this workflow. + env: + GH_TOKEN: ${{ github.token }} + run: | + gh workflow run .github/workflows/deploy.yml -R "${{ github.repository }}"