Skip to content

Release a new version #7

Release a new version

Release a new version #7

Workflow file for this run

name: Fast-Forward Merge
on:
issue_comment:
types: [created]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
ff_merge:
runs-on: ubuntu-latest
outputs:
head-ref: ${{ steps.pr-variables.outputs.PR_HEAD_REF }}
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/ff-merge') && github.event.comment.author_association == 'MEMBER' }}
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch Variables
id: pr-variables
run: |
echo "PR_HEAD_REF=$(gh pr view '${{ github.event.issue.number }}' --repo '${{ github.repository }}' --json headRefName --jq '.headRefName')" >> "$GITHUB_OUTPUT"
echo "PR_BASE_REF=$(gh pr view '${{ github.event.issue.number }}' --repo '${{ github.repository }}' --json baseRefName --jq '.baseRefName')" >> "$GITHUB_OUTPUT"
echo "PR_AUTHOR=$(gh pr view '${{ github.event.issue.number }}' --repo '${{ github.repository }}' --json author --jq '.author.id')" >> "$GITHUB_OUTPUT"
- name: "FF Merge"
run: |
git checkout ${{ steps.pr-variables.outputs.PR_HEAD_REF }}
git checkout ${{ steps.pr-variables.outputs.PR_BASE_REF }}
git merge --ff-only ${{ steps.pr-variables.outputs.PR_HEAD_REF }}
git push
remove_branch:
needs: ff_merge
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Remove branch
env:
BRANCH_NAME: ${{ needs.ff_merge.outputs.head-ref}}
run: |
if [[ "$BRANCH_NAME" == release-* ]]; then
echo "Removing branch: $BRANCH_NAME"
# Remove the remote branch
git push origin --delete "$BRANCH_NAME"
else
echo "Branch '$BRANCH_NAME' does not match 'release-*', skipping."
fi