-
-
Notifications
You must be signed in to change notification settings - Fork 718
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3567 from kingthorin/evalvillain-wf
chore: Add Eval Villain update GitHub Action Workflow
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Create Eval Villain Update PR | ||
|
||
on: | ||
schedule: | ||
- cron: '0 3 2 * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
create_pr: | ||
name: Create Pull Request | ||
if: github.actor == 'kingthorin' || github.actor == 'psiinon' || github.actor == 'thc202' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Build Feature Branch and Raise PR | ||
run: | | ||
# Setup git details | ||
export GITHUB_USER=zapbot | ||
git config --global user.email "[email protected]" | ||
git config --global user.name $GITHUB_USER | ||
# Download extension and Clone repo | ||
curl https://addons.mozilla.org/firefox/downloads/latest/eval-villain/addon-3904727-latest.xpi --output eval_villain-latest-fx.xpi | ||
git clone -o upstream https://github.com/zaproxy/zap-extensions.git | ||
cd zap-extensions | ||
git remote add origin https://github.com/$GITHUB_USER/zap-extensions.git | ||
# Setup env vars for later | ||
BRANCH="eval-villian-update" | ||
SHORT_DATE="$(date +"%Y-%m-%d")" | ||
export GITHUB_TOKEN=${{ secrets.ZAPBOT_TOKEN }} | ||
# Build the feature branch | ||
git checkout -b $BRANCH | ||
rm -rf addOns/evalvillain/src/main/zapHomeFiles/selenium/extensions/*.xpi | ||
cp -f ../eval_villain-latest-fx.xpi addOns/evalvillain/src/main/zapHomeFiles/selenium/extensions/eval_villain-latest-fx.xpi | ||
## Update the index to be sure git is aware of changes | ||
git update-index -q --refresh | ||
## If there are changes: comment, commit, PR | ||
if ! git diff-index --quiet HEAD --; then | ||
./gradlew :addOns:evalvillain:updateChangelog --change="- Updated with new version of Eval Villain." | ||
git remote set-url origin https://$GITHUB_USER:[email protected]/$GITHUB_USER/zap-extensions.git | ||
git add . | ||
git commit -m "Eval Villain Update $SHORT_DATE" -m "Updates based on https://addons.mozilla.org/firefox/addon/eval-villain/" --signoff | ||
git push --set-upstream origin $BRANCH --force | ||
# Open the PR | ||
hub pull-request --no-edit | ||
fi |