diff --git a/.gitea/workflows/011_permissions.yaml b/.gitea/workflows/011_permissions.yaml new file mode 100644 index 0000000..dc1506f --- /dev/null +++ b/.gitea/workflows/011_permissions.yaml @@ -0,0 +1,23 @@ +name: "Permissions" + +on: + workflow_dispatch: + +jobs: + example-job: + permissions: + contents: write + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Attempt Write Operation + run: | + touch permissions-test.txt + git config --global user.name 'hangpersonal' + git config --global user.email 'hangcui1201@gmail.com' + git add permissions-test.txt + git commit -m "Attempt to write" + git push origin ${{ github.ref }} \ No newline at end of file diff --git a/.gitea/workflows/011_permissions_error.yaml b/.gitea/workflows/011_permissions_error.yaml new file mode 100644 index 0000000..c507a0f --- /dev/null +++ b/.gitea/workflows/011_permissions_error.yaml @@ -0,0 +1,29 @@ +name: "Permissions Error" + +on: + workflow_dispatch: + +permissions: + contents: read # only read commits/tags cannot create ones from this workflow + +jobs: + example-job: + # It can be also here for job scope + # permissions: + # contents: read + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Attempt Write Operation + run: | + # This is an intentional error to demonstrate lack of write permissions + touch new-file.txt + git config --global user.name 'hangpersonal' + git config --global user.email 'hangcui1201@gmail.com' + git add new-file.txt + git commit -m "Attempt to write" + git push origin ${{ github.ref }} + continue-on-error: true \ No newline at end of file