Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/fast-forward.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Fast forward

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write
issues: write

jobs:
fast-forward:
if: ${{ (contains(github.event.comment.body, '/fast-forward')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Parse slash command as an exact trigger

Using contains(github.event.comment.body, '/fast-forward') causes the merge job to run whenever that substring appears anywhere in a maintainer comment, so a message like please don't /fast-forward yet still executes the merge path. Because this workflow has write permissions, accidental mentions can mutate PR state unexpectedly; the condition should match an explicit command token rather than a substring.

Useful? React with 👍 / 👎.

|| github.event.comment.body == '/ff')
&& github.event.issue.pull_request
&& (github.event.comment.author_association == 'OWNER'
|| github.event.comment.author_association == 'MEMBER') }}
runs-on: ubuntu-latest
steps:
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4.0.0
with:
comment-id: ${{ github.event.comment.id }}
reactions: rocket
- name: Fast forwarding
uses: sequoia-pgp/fast-forward@v1.0.0
with:
merge: true
comment: always
github_token: ${{ secrets.GH_PUSH_TOKEN }}

rebase:
if: ${{ contains(github.event.comment.body, '/rebase')
&& github.event.issue.pull_request
&& (github.event.comment.author_association == 'OWNER'
|| github.event.comment.author_association == 'MEMBER') }}
runs-on: ubuntu-latest
steps:
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4.0.0
with:
comment-id: ${{ github.event.comment.id }}
reactions: rocket
- name: Set git user
run: |
git config --global user.email "ci@fashionunited.com"
git config --global user.name "CI FashionUnited"
- name: Get pull request ref
id: get_pull_request_ref
uses: octokit/request-action@v2.4.0
with:
route: GET /repos/:repository/pulls/:issue_id
repository: ${{ github.repository }}
issue_id: ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ fromJSON(steps.get_pull_request_ref.outputs.data).head.ref }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Checkout the PR head repository before rebasing

The rebase flow checks out only head.ref but does not set repository, so actions/checkout targets github.repository (the base repo). For fork-based PRs, that branch exists only in the fork, so this step fails (or can resolve to an unrelated same-named branch in the base repo), preventing /rebase from working reliably for external contributions.

Useful? React with 👍 / 👎.

fetch-depth: 0
persist-credentials: false
token: ${{ secrets.GH_PUSH_TOKEN }}
- name: Set git credentials
run: git remote set-url origin https://x-access-token:${{ secrets.GH_PUSH_TOKEN }}@github.com/${{ github.repository }}
- name: Fetch default branch
run: git fetch origin ${{ github.event.repository.default_branch }}
- name: Rebase branch on default branch
run: git rebase origin/${{ github.event.repository.default_branch }}
- name: Verify rebase success
run: |
if git status --porcelain | grep -q '^'; then
echo "Working directory is dirty after rebase"
exit 1
fi
- name: Force push to branch
run: git push --force-with-lease origin HEAD
Loading