Skip to content

Commit

Permalink
ci+feat: Updated all workflow actions and added release/change-logs
Browse files Browse the repository at this point in the history
- Added version of bot to the initial print msg
  • Loading branch information
Vel-San committed Feb 22, 2024
1 parent bec1c91 commit d0d94e6
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

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

- name: Run TruffleHog OSS
uses: trufflesecurity/trufflehog@v3.67.6
16 changes: 14 additions & 2 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
paths:
- 'ci/**'
- 'wbmbot_v2/**'
workflow_run:
workflows: ["Release and Auto Change Log"]
types:
- completed

jobs:
build-and-push:
Expand All @@ -16,14 +20,22 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Get latest tag
id: latest_tag
run: echo "::set-output name=TAG::$(git describe --abbrev=0 --tags || echo '')"

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t vel7an/wbmbot_v2 -f ci/docker/Dockerfile .
if: steps.latest_tag.outputs.TAG != ''
run: docker build -t vel7an/wbmbot_v2:${{ steps.latest_tag.outputs.TAG }} -t vel7an/wbmbot_v2:latest -f ci/docker/Dockerfile .

- name: Push Docker image to Docker Hub
run: docker push vel7an/wbmbot_v2
if: steps.latest_tag.outputs.TAG != ''
run: |
docker push vel7an/wbmbot_v2:${{ steps.latest_tag.outputs.TAG }}
docker push vel7an/wbmbot_v2:latest
29 changes: 29 additions & 0 deletions .github/workflows/release-and-auto-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release and Auto Change Log

on:
push:
tags:
- 'v*.*.*'

jobs:
release-and-create-changelog:
name: Automatic Release & Changelog Creator
runs-on: ubuntu-latest

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

- name: Auto Changelog
id: changelog
uses: ardalanamini/auto-changelog@v4.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
uses: softprops/action-gh-release@v0.1.15
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
${{ steps.changelog.outputs.changelog }}
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

![Code Format](https://img.shields.io/badge/CODE%20FORMAT-BLACK-black?style=flat-square&logo=python)

![Static Badge](https://img.shields.io/badge/BOT_VERSION-v1.0.0-teal?style=flat-square)

![Alt](https://repobeats.axiom.co/api/embed/ab658dc363a9401ed4e7171a5442d8e1c1fe585b.svg "Repobeats analytics image")

- [WBMBOT\_v2](#wbmbot_v2)
Expand All @@ -21,6 +23,8 @@
- [Build](#build)
- [Pull](#pull)
- [Run](#run)
- [Without e-mail notifications](#without-e-mail-notifications)
- [With e-mail notifications](#with-e-mail-notifications)
- [Filtering Strategy](#filtering-strategy)
- [Logging](#logging)
- [Additional Information](#additional-information)
Expand All @@ -29,7 +33,9 @@

# WBMBOT_v2

> An improved work-in-progress (WIP) and fully refactored version of the original [WBMBOT by David Fischer](https://github.com/fischer-hub/wbmbot).
```
An improved work-in-progress (WIP) and fully refactored version of the original [WBMBOT by David Fischer](https://github.com/fischer-hub/wbmbot).
```

WBMBOT_v2 is a Selenium-based Python bot designed to automate the application process for new flats listed by WBM Wohnungsbaugesellschaft Berlin-Mitte GmbH. It prioritizes speed and efficiency to ensure your application is among the first 1000 considered in the random selection process for apartment viewings.

Expand Down Expand Up @@ -94,7 +100,9 @@ To do so, you need to export `EMAIL_PASSWORD` to your environment variables. If

**NOTE**: Only `@outlook.com` emails are currently supported

> export EMAIL_PASSWORD=(password)
```bash
export EMAIL_PASSWORD=<password>
```

## Outputs

Expand Down Expand Up @@ -142,8 +150,21 @@ If running for the first time, use `-it` to setup your config, if you already ha

If you want to send emails as well to yourself as notifications, please add `-e "EMAIL_PASSWORD=<password>"` to the command

#### Without e-mail notifications

```bash
docker run -it \
-v /PATH_HERE/offline_viewings:/home/offline_viewings \
-v /PATH_HERE/logging:/home/logging \
-v /PATH_HERE/configs:/home/configs \
vel7an/wbmbot_v2:latest
```

#### With e-mail notifications

```bash
docker run -it \
-e "EMAIL_PASSWORD=<password>" \
-v /PATH_HERE/offline_viewings:/home/offline_viewings \
-v /PATH_HERE/logging:/home/logging \
-v /PATH_HERE/configs:/home/configs \
Expand Down
3 changes: 3 additions & 0 deletions wbmbot_v2/helpers/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import datetime as dt
import os

# Bot version (MAJOR.MINOR.PATCH)
bot_version = "1.0.0"

# Today
today = dt.date.today()
# Now
Expand Down
8 changes: 5 additions & 3 deletions wbmbot_v2/helpers/webDriverOperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
from helpers import constants, notifications
from httpsWrapper import httpPageDownloader as hpd
from logger import wbm_logger
from selenium.common.exceptions import (NoSuchElementException,
StaleElementReferenceException,
TimeoutException)
from selenium.common.exceptions import (
NoSuchElementException,
StaleElementReferenceException,
TimeoutException,
)
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
Expand Down
2 changes: 1 addition & 1 deletion wbmbot_v2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def parse_args():
LOG = color_me.create_logger()

# Create ChromeDriver
LOG.info(color_me.cyan("Initializing Script 🚀"))
LOG.info(color_me.cyan(f"Initializing Script (v{constants.bot_version}) 🚀"))
LOG.info(color_me.cyan("Checking for internet connection 🔎"))
while True:
if not misc_operations.check_internet_connection():
Expand Down

0 comments on commit d0d94e6

Please sign in to comment.