chore: npm (deps-dev): bump mocha from 11.3.0 to 11.4.0 in the all-dependencies group #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Merge | |
on: | |
pull_request: | |
types: [labeled] | |
jobs: | |
fast-forward: | |
# Only run if the label is "merge" | |
if: ${{ github.event.label.name == 'merge' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.BUILD_APP_ID }} | |
private-key: ${{ secrets.BUILD_PRIVATE_KEY }} | |
- name: 'Checkout source code' | |
uses: 'actions/checkout@v3' | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
fetch-depth: 0 | |
# Checking out the PR head branch | |
ref: ${{ github.head_ref }} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- name: Configure Git | |
run: | | |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
- name: Attempt Fast-Forward Merge | |
id: merge | |
run: | | |
# Fetch the latest from the base branch | |
git fetch origin ${{ github.base_ref }} | |
# Check if this is a fast-forward merge | |
if git merge-base --is-ancestor origin/${{ github.base_ref }} HEAD; then | |
echo "PR is fast-forward mergeable" | |
# Switch to the base branch | |
git checkout ${{ github.base_ref }} | |
# Fast-forward to the PR branch | |
git merge --ff-only ${{ github.head_ref }} | |
# Push the changes | |
git push origin ${{ github.base_ref }} | |
# Add success comment to the PR | |
gh pr comment ${{ github.event.pull_request.number }} --body "✅ Fast-forward merge completed successfully!" | |
echo "merge_status=success" >> "$GITHUB_OUTPUT" | |
else | |
echo "PR cannot be fast-forwarded. Base branch has diverged from the head branch." | |
# Add error comment to the PR | |
gh pr comment ${{ github.event.pull_request.number }} --body "❌ Fast-forward merge failed: The base branch has diverged from this PR branch. Please rebase the PR branch onto the latest base branch." | |
# Remove the merge label | |
gh pr edit ${{ github.event.pull_request.number }} --remove-label "merge" | |
echo "merge_status=failed" >> "$GITHUB_OUTPUT" | |
exit 1 | |
fi | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} |