From 7a094d3399321d1b7dd55138163e045e10ddcdd5 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Sun, 28 Jan 2024 23:10:25 +0800 Subject: [PATCH] ci: add trigger user permission check --- .github/workflows/build-runner.yml | 14 +++++++++++++- tools/Dockerfile | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-runner.yml b/.github/workflows/build-runner.yml index f73defa..aa87ada 100644 --- a/.github/workflows/build-runner.yml +++ b/.github/workflows/build-runner.yml @@ -10,9 +10,21 @@ jobs: if: github.repository == 'virt-s1/bootc-workflow-test' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Get User Permission + id: user_permission + uses: actions-cool/check-user-permission@v2 + with: + require: write + username: ${{ github.triggering_actor }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: checkout code + if: steps.user_permission.require-result == 'true' + uses: actions/checkout@v3 - name: Build container + if: steps.user_permission.require-result == 'true' run: | sudo apt-get install -y podman podman build -t bootc-test-runner:x86_64 -f tools/Dockerfile tools diff --git a/tools/Dockerfile b/tools/Dockerfile index 4a779a5..e795d53 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -24,4 +24,4 @@ RUN dnf -y update && \ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ unzip awscliv2.zip && \ ./aws/install && \ - rm -rf aws awscliv2.zip && \ + rm -rf aws awscliv2.zip