From b84a9dc9d4f43e6a4d08fa63ac48553fd5e9ca8c Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 18 Apr 2024 04:41:27 +0200 Subject: [PATCH] Various improvements and testing --- .github/workflows/check-changelog.yml | 6 ++++++ .github/workflows/main.yml | 7 ++++++- .github/workflows/regular-release.yml | 11 ++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml index 04446c3..ca89f84 100644 --- a/.github/workflows/check-changelog.yml +++ b/.github/workflows/check-changelog.yml @@ -6,12 +6,18 @@ on: # Edited such that we can detect changes to the description types: [opened, synchronize, reopened, edited] +permissions: + pull-requests: read + jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: + # We need to fetch the parents of the HEAD commit (which is a merge), + # because we need to compare the PR against the base branch + # to check whether it added a changelog fetch-depth: 2 - name: check changelog diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32abadb..d664200 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,11 +45,16 @@ jobs: GH_TOKEN: ${{ github.token }} - name: Outputting draft release notes + # If we have a new version at all (it's not an empty string) + # And it's not a push event (so it's a PR), if: ${{ env.version && github.event_name != 'push' }} + # we just output the draft changelog into the step summary run: cat changes/released/${{ env.version }}.md > "$GITHUB_STEP_SUMMARY" - name: Update release branch - #if: ${{ env.version && github.event_name == 'push' }} + # But if this is a push te the main branch, + if: ${{ env.version && github.event_name == 'push' }} + # we push to the release branch. # This continuously updates the release branch to contain the latest release notes, # so that one can just merge the release branch into main to do a release. # A PR to do that is opened regularly with another workflow diff --git a/.github/workflows/regular-release.yml b/.github/workflows/regular-release.yml index cf68973..b3c2c76 100644 --- a/.github/workflows/regular-release.yml +++ b/.github/workflows/regular-release.yml @@ -3,17 +3,22 @@ on: workflow_dispatch: # Allows triggering manually schedule: - cron: '47 14 * * 2' # runs every Tuesday at 14:47 UTC (chosen somewhat randomly) + pull_request: + branches: + main jobs: version: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Create Pull Request run: | + subject=$(git log -1 --format=%s HEAD) gh pr create \ - --repo ${{ github.repository }} \ - --fill \ - --head release + --title "$(head -1 <<< "$subject")" \ + --body "$(tail -1 <<< "$subject")" env: # Needed so that CI triggers GH_TOKEN: ${{ secrets.MACHINE_USER_PAT }}