Skip to content

Commit 17047cd

Browse files
committed
ci
1 parent c7c92b9 commit 17047cd

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

.github/_permission_check.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# The below allows PRs from forks to access the secrets in a secure way
2+
# https://michaelheap.com/access-secrets-from-forks
3+
# NOTE: Reviewer has to check whether the code in PR does not expose secrets!
4+
name: permission check
5+
6+
on:
7+
workflow_call:
8+
9+
jobs:
10+
check-permission:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: echo
14+
echo "github.triggering_actor ${{ github.triggering_actor }}"
15+
echo "github.actor ${{ github.actor }}"
16+
17+
- name: get user permission
18+
id: checkAccess
19+
uses: actions-cool/check-user-permission@v2
20+
with:
21+
require: write
22+
username: ${{ github.triggering_actor }}
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: check user permission
27+
if: github.triggering_actor != 'dependabot[bot]' && github.triggering_actor != 'renovate[bot]' && steps.checkAccess.outputs.require-result == 'false'
28+
run: |
29+
echo "${{ github.triggering_actor }} does not have permissions on this repo."
30+
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
31+
echo "Job originally triggered by ${{ github.actor }}"
32+
exit 1

.github/check.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Checks
2+
run-name: Checks, branch:${{ github.ref_name }}, triggered by @${{ github.actor }}
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
6+
cancel-in-progress: true
7+
8+
on:
9+
pull_request_target:
10+
branches:
11+
- '**'
12+
push:
13+
branches:
14+
- 'main'
15+
tags:
16+
- '**'
17+
workflow_dispatch: {}
18+
19+
jobs:
20+
check-permission:
21+
uses: ./.github/workflows/_permission_check.yaml
22+
secrets: inherit
23+
24+
checks:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)