mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
74 lines
2.6 KiB
YAML
74 lines
2.6 KiB
YAML
name: Changelog Validation (v3)
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ v3-alpha ]
|
|
workflow_dispatch:
|
|
inputs:
|
|
pr_number:
|
|
description: 'PR number to validate (for manual testing)'
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
validate-changelog:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request' || github.event.inputs.pr_number
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || format('refs/pull/{0}/head', github.event.inputs.pr_number) }}
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- name: Get PR information
|
|
id: pr_info
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
|
echo "base_ref=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "pr_number=${{ github.event.inputs.pr_number }}" >> $GITHUB_OUTPUT
|
|
echo "base_ref=v3-alpha" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Check if changelog was modified
|
|
id: changelog_check
|
|
run: |
|
|
git fetch origin ${{ steps.pr_info.outputs.base_ref }}
|
|
if git diff --name-only origin/${{ steps.pr_info.outputs.base_ref }}..HEAD | grep -q "v3/UNRELEASED_CHANGELOG.md"; then
|
|
echo "changelog_modified=true" >> $GITHUB_OUTPUT
|
|
echo "✅ UNRELEASED_CHANGELOG.md was modified in this PR"
|
|
else
|
|
echo "changelog_modified=false" >> $GITHUB_OUTPUT
|
|
echo "⚠️ UNRELEASED_CHANGELOG.md was not modified"
|
|
fi
|
|
|
|
- name: Comment on PR about missing changelog
|
|
if: steps.changelog_check.outputs.changelog_modified == 'false' && github.event_name == 'pull_request'
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const author = context.payload.pull_request.user.login;
|
|
const message = '## ⚠️ Missing Changelog Update\n\n' +
|
|
`Hi @${author}, please update \`v3/UNRELEASED_CHANGELOG.md\` with a description of your changes.\n\n` +
|
|
'This helps us keep track of changes for the next release.';
|
|
|
|
await github.rest.issues.createComment({
|
|
issue_number: ${{ steps.pr_info.outputs.pr_number }},
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: message
|
|
});
|
|
|