92 lines
No EOL
2.8 KiB
YAML
92 lines
No EOL
2.8 KiB
YAML
name: Create Release PR
|
||
run-name: "👾 Create Release PR"
|
||
on:
|
||
push:
|
||
branches:
|
||
- dev
|
||
paths-ignore:
|
||
- '**'
|
||
- '!.github/workflows/create-pr.yml'
|
||
- '!CHANGELOG.md'
|
||
|
||
concurrency:
|
||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||
cancel-in-progress: true
|
||
|
||
jobs:
|
||
create-pr:
|
||
name: 🤝 Create Release PR
|
||
if: ${{ github.repository_owner == 'TerraFirmaGreg-Team' }}
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
|
||
- name: Checkout
|
||
uses: actions/checkout@v4.2.2
|
||
with:
|
||
fetch-depth: 0
|
||
|
||
- name: 📊 Get Pakku Info
|
||
id: pakku_info
|
||
uses: ActionsTools/read-json-action@v1.0.5
|
||
with:
|
||
file_path: "pakku.json"
|
||
|
||
- name: 📊 Get Pakku-lock Info
|
||
id: pakku_lock_info
|
||
uses: ActionsTools/read-json-action@v1.0.5
|
||
with:
|
||
file_path: "pakku-lock.json"
|
||
|
||
- name: 📄 Changelog Parser
|
||
id: changelog
|
||
uses: coditory/changelog-parser@v1.0.2
|
||
with:
|
||
path: CHANGELOG.md
|
||
continue-on-error: true
|
||
|
||
- name: 🔍 Check if tag exists
|
||
uses: mukunku/tag-exists-action@v1.6.0
|
||
id: check_tag
|
||
with:
|
||
tag: ${{ steps.changelog.outputs.version }}
|
||
|
||
- name: 🔍 Check existing PRs
|
||
if: ${{ steps.check_tag.outputs.exists == 'false' }}
|
||
id: check_existing_pr
|
||
uses: actions/github-script@v7.0.1
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
with:
|
||
result-encoding: string
|
||
script: |
|
||
try {
|
||
const { data: prs } = await github.rest.pulls.list({
|
||
owner: context.repo.owner,
|
||
repo: context.repo.repo,
|
||
state: 'open',
|
||
head: `${context.repo.owner}:dev`,
|
||
base: 'main'
|
||
});
|
||
|
||
core.setOutput('exists', prs.length > 0);
|
||
console.log(`ℹ️ PR exists: ${prs.length > 0}`);
|
||
} catch (error) {
|
||
core.setFailed(`❌ PR check failed: ${error}`);
|
||
core.setOutput('exists', true);
|
||
}
|
||
|
||
- name: 🔍 Create Pull Request if tag not found
|
||
if: ${{ steps.check_existing_pr.outputs.exists == 'false' }}
|
||
uses: devops-infra/action-pull-request@v0.6.0
|
||
with:
|
||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||
source_branch: dev
|
||
target_branch: main
|
||
reviewer: Xikaro
|
||
ignore_users: "dependabot"
|
||
title: 'Release: ${{ steps.changelog.outputs.version }}'
|
||
body: |
|
||
**This is an automated Pull Request from the dev branch.**
|
||
📃 **Name**: ${{ steps.pakku_info.outputs.name }}
|
||
📃 **Release**: `${{ steps.changelog.outputs.version }}`
|
||
📃 **Release Type**: `${{ steps.pakku_info.outputs.release_type }}` |