Skip to content

Commit

Permalink
Update remove.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
emadadel4 committed Sep 22, 2024
1 parent eeff85f commit ee73450
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions .github/workflows/remove.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
name: Delete File on Push
name: Remove winutil.ps1 if included in a Push

on:
on:
push:
branches:
- main # Specify the branch you want to trigger the action on
- '**'

jobs:
delete_file:
check-and-delete-file:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Check if winutil.ps1 exists
id: check_existence
run: |
if [ -f "st.ps1" ]; then
echo "winutil_exists=true" >> $GITHUB_OUTPUT
else
echo "winutil_exists=false" >> $GITHUB_OUTPUT
fi
- name: Delete file if it exists
run: |
if [ -f "st.ps1" ]; then
git rm "st.ps1"
git commit -m "Remove file.txt if it exists"
git push
else
echo "File does not exist."
fi
- name: Delete winutil.ps1 if it exists
if: steps.check_existence.outputs.winutil_exists == 'true'
run: |
git config --global user.email "[email protected]"
git config --global user.name "winutil-action"
git rm st.ps1
git commit -m "Delete winutil.ps1 as it is not allowed"
git push origin HEAD:${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit ee73450

Please sign in to comment.