Skip to content

Commit

Permalink
Merge pull request #73 from zowe/update-workflows-v1
Browse files Browse the repository at this point in the history
Update workflow permissions (v1)
  • Loading branch information
awharn authored Sep 6, 2024
2 parents 5fae7b6 + 34005c1 commit 0c34134
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
test:
runs-on: ubuntu-latest
if: (!contains(github.event.head_commit.message, '[ci skip]'))

permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -129,6 +130,8 @@ jobs:
needs: test
runs-on: ubuntu-latest
if: ${{ needs.test.result == 'success' && github.event_name == 'workflow_dispatch' && (github.ref_name == 'master' || github.ref_name == 'zowe-v1-lts') && github.event.inputs.zowe-version && github.event.inputs.zowe-version != '' && github.event.inputs.release == 'true' }}
permissions:
contents: write
steps:
- name: Checkout Pages Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -157,6 +160,8 @@ jobs:
needs: test
runs-on: ubuntu-latest
if: needs.test.result == 'success' && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'zowe-v1-lts')
permissions:
contents: write
steps:
- name: Checkout Pages Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -192,6 +197,9 @@ jobs:
needs: test
runs-on: ubuntu-latest
if: needs.test.result == 'success' && github.event_name == 'pull_request_target'
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout Pages Branch
uses: actions/checkout@v4
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Remove Closed PR Contents

on:
pull_request_target:
types: closed

jobs:
remove-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Pages Branch
uses: actions/checkout@v4
with:
ref: 'gh-pages'

- name: Remove directory
env:
GITHUB_TOKEN: ${{ secrets.ZOWE_ROBOT_TOKEN }}
run: |
rm -rf docs/pr-${{ github.event.number }}
git config --global user.name ${{ secrets.ZOWE_ROBOT_USER }}
git config --global user.email ${{ secrets.ZOWE_ROBOT_EMAIL }}
git rm -r docs/pr-${{ github.event.number }}
git commit -sm "Remove Zowe Web Help for PR ${{ github.event.number }}"
git push origin HEAD
gh workflow run -r gh-pages deploy-pages.yml

0 comments on commit 0c34134

Please sign in to comment.