-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not creates a push event #36
Comments
This is probably due to workflows not being allowed to start other workflows in order to avoid loops. You can get around the above limitation by using a GitHub app. Here are some instructions to set one up. In the end, since my use case was rather simple, and since I wasn't sure what name: Fast-forward
on:
issue_comment:
types: [created, edited]
jobs:
fast_forward:
name: Fast-forward
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request &&
github.event.comment.author_association == 'OWNER' &&
contains(github.event.comment.body, '/fast-forward')
steps:
- name: Generate access token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.LOKSMITH_ID }}
private_key: ${{ secrets.LOCKSMITH_PRIVATE_KEY }}
- name: Fetch repository
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0
- name: Checkout pull request
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Fast-forward & push
run: |
export PR_COMMIT=$(git rev-parse HEAD)
git checkout main
git merge --ff-only $PR_COMMIT
git push origin main The same, but instead of reacting to a comment, this reacts to applying the label name: Fast-forward
on:
pull_request:
types: [labeled]
jobs:
fast_forward:
name: Fast-forward
runs-on: ubuntu-latest
if: github.event.label.name == 'fast-forward'
steps:
- name: Generate access token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.LOKSMITH_ID }}
private_key: ${{ secrets.LOCKSMITH_PRIVATE_KEY }}
- name: Checkout pull request
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0
- name: Fast-forward & push
env:
PR_COMMIT: ${{ github.event.pull_request.head.sha }}
run: |
git checkout main
git merge --ff-only "$PR_COMMIT"
git push origin main |
@mildred did you ever find a solution? Unfortunately not being able to initiate my |
The solution is quite simple: instead of using automatically provided - name: Fast-forward PR
uses: endre-spotlab/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }} Where @endre-spotlab probably makes sense to put it in |
This action does not seem to create a GitHub push event, workflows registered on the target branch with a push event are not executed.
The text was updated successfully, but these errors were encountered: