-
-
Notifications
You must be signed in to change notification settings - Fork 396
94 lines (91 loc) · 3.65 KB
/
pr_actions.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This file contains actions that can be performed on PRs by issuing a comment
name: 🕹️ On demand PR action
on:
issue_comment:
types: [created, edited]
jobs:
# Action to update test results by issuing /lint
run_lint:
name: "On demand linting"
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '/lint')
runs-on: ubuntu-latest
steps:
- name: Get branch name
# see https://github.com/actions/checkout/issues/331
id: get-branch
run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# grab the PR branch
ref: ${{ steps.get-branch.outputs.branch }}
# We can't use GITHUB_TOKEN here because, github actions can't trigger actions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
# So this is a personal access token
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
# we need origin/main to have comparison linting work !
- name: Fetch origin/main
run: |
git remote set-branches --add origin main
git fetch origin
- name: Run linting
run: make lint front_lint
- name: Push changes if needed
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Linting changes"
branch: ${{ github.event.pull_request.head.ref }}
commit_user_name: Open Food Facts Bot
commit_user_email: [email protected]
commit_author: Open Food Facts Bot <[email protected]>
push_options: ""
status_options: '--untracked-files=no'
skip_dirty_check: false
create_branch: no
# Action to update test results by issuing /update_tests_results
update_test_results:
name: "On demand Update Tests Results"
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '/update_tests_results')
runs-on: ubuntu-latest
steps:
- name: Get branch name
# see https://github.com/actions/checkout/issues/331
id: get-branch
run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# grab the PR branch
ref: ${{ steps.get-branch.outputs.branch }}
# We can't use GITHUB_TOKEN here because, github actions can't trigger actions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
# So this is a personal access token
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- name: Run update tests results
run: make update_tests_results
- name: Push changes if needed
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "test: Update tests results"
branch: ${{ github.event.pull_request.head.ref }}
commit_user_name: Open Food Facts Bot
commit_user_email: [email protected]
commit_author: Open Food Facts Bot <[email protected]>
push_options: ""
status_options: '--untracked-files=no'
skip_dirty_check: false
create_branch: no