From aab068e1a20ecd0949f5726b1db2fc37d0ad8d97 Mon Sep 17 00:00:00 2001 From: Day <13383838+wwwDayDream@users.noreply.github.com> Date: Tue, 11 Jun 2024 00:05:22 -0500 Subject: [PATCH] Update mergeable/auto-changelog@RedEyeMods/.github (#169) * Change to on comment only * Included more branches * Actually name it yml.... * Actually add it! * Stringify the context (#153) * Auto Changelog Substance (#159) * Working theory * Updated quotes * Fixed some formatting and enabled issue comment * Prelogging (#162) * Some real crimes (#164) * Prelogging * Updated crimes * Event that fires auto-changelog (#167) * Changed to pull request events * Additional Logging * Adjusted branches accordingly * Finalizing execution * Updated README.md * Try double checkout * Clean false * Branch tracking * Wrong reset * Wording * I've been bamboozled * Remove first * Updated CHANGELOG.md * Updated CHANGELOG.md * Do some logging * Switched over to labeling * Equals true lol * Continue on errors * Updated CHANGELOG.md * Updated CHANGELOG.md * Updated CHANGELOG.md * Updated CHANGELOG.md --- .github/workflows/auto-pr-changelog.yml | 27 ++++++++++++++++--------- CHANGELOG.md | 12 +++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/auto-pr-changelog.yml b/.github/workflows/auto-pr-changelog.yml index 64c3411..6cf99ff 100644 --- a/.github/workflows/auto-pr-changelog.yml +++ b/.github/workflows/auto-pr-changelog.yml @@ -1,21 +1,27 @@ name: "Auto Changelog" on: - issue_comment: - types: [created] + pull_request: + types: [labeled, unlabeled] jobs: auto-changelog: + if: ${{ github.event.label.name == 'Changelog' }} env: - COMMENT_BODY: ${{ github.event.comment.body }} - if: ${{ (contains(github.event.comment.body, '+changelog') || contains(github.event.comment.body, '-changelog')) && github.event.comment.user.login == github.event.issue.user.login }} + LABEL_ADDED: ${{ github.event.action == 'labeled' }} + PR_TITLE: ${{ github.event.pull_request.title }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: + ref: ${{ github.head_ref }} + clean: false fetch-depth: 0 filter: tree:0 + - run: | + git branch --track ${{ github.base_ref }} origin/${{ github.base_ref }} + - name: Import GPG key uses: crazy-max/ghaction-import-gpg@v6 with: @@ -27,14 +33,15 @@ jobs: - name: Reset Changelog continue-on-error: true run: | - git checkout ${{ github.ref_name }} -- ./README.md + rm CHANGELOG.md + git checkout ${{ github.base_ref }} -- CHANGELOG.md - name: CHANGELOG Setup - if: ${{ contains(github.event.comment.body, '+changelog') }} + if: ${{ env.LABEL_ADDED == 'true' }} uses: actions/github-script@v7 env: HEAD_REF: ${{ github.head_ref }} - ISSUE_TITLE: ${{ github.event.issue.title }} + ISSUE_TITLE: ${{ env.PR_TITLE }} with: script: | const fs = require('fs'); @@ -173,6 +180,7 @@ jobs: console.log(headRef); var category = headRef.split('/')[0]; var potentialHead = masterHead.changelog.unreleased[category]; + console.log(potentialHead); if (potentialHead != null) { potentialHead.children.push('- ' + process.env.ISSUE_TITLE); } @@ -182,9 +190,10 @@ jobs: console.log("-=-=-=-=-\nWhat we have exported..."); console.log(masterHead.toString()); - - run: | + - continue-on-error: true + run: | git add . - git commit -am "Updated README.md" + git commit -am "Updated CHANGELOG.md" - name: PR Check id: pr-check diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5b981c3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Changed + +- Update mergeable/auto-changelog@RedEyeMods/.github