-
Notifications
You must be signed in to change notification settings - Fork 7
47 lines (40 loc) · 1.68 KB
/
fast_forward.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Fast-forward merge a pull request
on:
issue_comment:
types:
- created
- edited
jobs:
fast-forward:
name: "Fast-forward"
runs-on: ubuntu-latest
permissions:
contents: write # Allows merging the PR.
pull-requests: write # Writing comments on PRs.
issues: write # Also required for posting comments on PRs.
# Only run if the comment is one of the defined keywords.
if: >-
${{
github.event.issue.pull_request
&& contains(fromJSON('["/fast-forward", "/ff"]'), github.event.comment.body)
}}
steps:
- name: "Fast forwarding"
uses: MrThearMan/prff@v1
- name: "Trigger additional pipelines for bots"
# Only run if one of the defined bots is the pull request author.
# https://github.com/City-of-Helsinki/tilavarauspalvelu-core/settings/variables/actions
if: contains(fromJSON(vars.BOTS), github.event.pull_request.user.login)
# We need to trigger additional pipelines manually,
# since new pushes to main by bots do not trigger additional workflows.
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication
# Triggers all workflows with the `fast-forward` in `repository_dispatch`.
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "User-Agent: ${{ github.repository }}" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{"event_type":"fast-forward"}'