Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions .github/workflows/sanity-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
name: Sanity-tests@TF

on:
issue_comment:
types:
- created
pull_request_target:
types: [opened, synchronize, reopened]

jobs:
sanity:
# This job only runs for '[test]' pull request comments by owner, member
name: Sanity tests
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
&& contains(fromJson('["OWNER","MEMBER"]'), github.event.comment.author_association)
permissions:
contents: read
pull-requests: write
statuses: write

steps:
- name: Get pull request number
id: pr_nr
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
Comment thread
phracek marked this conversation as resolved.
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
PR_URL="${{ github.event.comment.issue_url }}"
echo "PR_NR=${PR_URL##*/}" >> $GITHUB_OUTPUT
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1

- name: Checkout repo
uses: actions/checkout@v7
with:
ref: "refs/pull/${{ steps.pr_nr.outputs.PR_NR }}/head"
ref: ${{ github.event.pull_request.head.sha }}
allow-unsafe-pr-checkout: true
Comment thread
phracek marked this conversation as resolved.

- name: Get pull request number
id: pr_nr
run: |
PR_URL="${{ github.event.pull_request.head.sha }}"
echo "PR_NR=${PR_URL##*/}" >> $GITHUB_OUTPUT

- name: Get sha
id: sha
Expand Down