Skip to content

Commit

Permalink
Update mergeable/auto-changelog@RedEyeMods/.github (#169)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wwwDayDream authored Jun 11, 2024
1 parent aea23b4 commit aab068e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/auto-pr-changelog.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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');
Expand Down Expand Up @@ -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);
}
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit aab068e

Please sign in to comment.