Skip to content

Commit

Permalink
Add program argument to changelog-combine.sh to determine the name …
Browse files Browse the repository at this point in the history
…of the output (#6372)
  • Loading branch information
Garanas authored Jul 29, 2024
1 parent 00f6186 commit 9dc74ad
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: Documentation - Generate changelog
on:
workflow_dispatch:
inputs:
reference:
reference:
required: true
type: choice
default: develop
Expand All @@ -35,19 +35,19 @@ on:

workflow_call:
inputs:
reference:
reference:
required: true
type: string
default: develop
description: The reference (branch or tag) to use to compile the changelog snippets from

pull_request:
paths:
- "changelog/snippets/*.md"
push:
branches:
- deploy/fafdevelop

jobs:
verify:
name: Verify snippets
Expand All @@ -71,7 +71,7 @@ jobs:
changelog/snippets
- name: Update environment path
run: |
run: |
ls
echo "${{ github.workspace }}/scripts/.github/workflows/scripts" >> $GITHUB_PATH
Expand Down Expand Up @@ -102,18 +102,26 @@ jobs:
changelog/snippets
- name: Update environment path
run: |
run: |
echo "${{ github.workspace }}/scripts/.github/workflows/scripts" >> $GITHUB_PATH
# We need to do this to remove `deploy/` from the reference. Specifically the `/` is problematic
- name: Update reference
run: |
REFERENCE="${{ inputs.reference }}"
NAME="${REFERENCE#deploy/}"
echo "NAME=$NAME" >> $GITHUB_ENV
- name: Create the changelog
working-directory: fa/changelog/snippets # script assumes it is in this directory
run: |
changelog-combine.sh
echo $NAME
echo ${{ env.NAME }}
changelog-combine.sh ${{ env.NAME }}
- name: Add the changelog as an artifact
uses: actions/upload-artifact@v4
with:
# we need to remove `deploy/` from the reference
name: changelog-${{ (inputs.reference == 'deploy/fafdevelop' && 'fafdevelop') || (inputs.reference == 'deploy/fafbeta' && 'fafbeta') || inputs.reference }}
name: changelog-${{ env.NAME }}
path: |
fa/changelog/snippets/faf-develop.md
fa/changelog/snippets/${{ env.NAME }}.md
9 changes: 5 additions & 4 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,19 @@ jobs:
uses: actions/download-artifact@v4
with:
name: changelog-fafdevelop
path: raw-changelog-fafdevelop
path: docs/generated

- name: Download artifact changelog of FAF Beta
uses: actions/download-artifact@v4
with:
name: changelog-fafbeta
path: raw-changelog-fafbeta
path: docs/generated

- name: Append the generated changelogs
run: |
cat raw-changelog-fafdevelop >> changelogs/fafdevelop.md
cat raw-changelog-fafbeta >> changelogs/fafbeta.md
ls -Rla generated
cat generated/fafdevelop.md >> changelogs/fafdevelop.md
cat generated/fafbeta.md >> changelogs/fafbeta.md
- name: Setup Ruby
uses: ruby/setup-ruby@v1
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/scripts/changelog-combine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ process_snippets() {
}

# Output file name
output="faf-develop.md"
output="changelog.md"
if [ "$1" ]; then
output="$1.md"
fi

echo "Writing output to: $output"

rm -f "$output"

# Add the initial header
Expand Down
10 changes: 10 additions & 0 deletions test-draft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

REFERENCE="deploy/fafdevelop"
NAME="${REFERENCE#deploy/}"
echo "$NAME"
echo "TEST"




0 comments on commit 9dc74ad

Please sign in to comment.