This repository includes two sections: Tasks and Project. The Tasks section focuses on foundational command-line operations, timestamping, and scripting. The Project section will integrate these tasks into a more comprehensive application.
- Directory Creation: Created directory structures with
mkdir
, navigating and verifying usingcd
andls
. - Timestamping: Utilized the
date
command to append and format timestamps, with automated file creation. - Weather Data Download: Downloaded weather data using
wget
, generating timestamped filenames. - Bash Scripting: Automated the download and file naming processes through a Bash script.
- Data Exploration: Analyzed downloaded weather data using pandas in Python, focusing on key metrics like temperature, wind speed, and humidity.
- Bash: Required for scripting and automation (
#!/usr/bin/bash
) - wget: For downloading data (
sudo apt-get install wget
for linux, while running on windows codespaces was used.) - Python: For data analysis with pandas (
pip install pandas
) - pandas: Python library for handling data (
pip install pandas
)
The Tasks section provides the groundwork for more advanced project integration.
This document summarizes the steps taken to automate weather data collection and workflow integration, along with key challenges and solutions.
- Modified the
weather.sh
script to run locally instead of using Codespaces. - Found this tutorial helpful for understanding cron jobs and creating my first one.
- Cron jobs are managed via the
crontab
command:crontab -l
: Lists all active cron jobs.crontab -e
: Opens the crontab for editing.
- Created an initial test job with the following entry:
(This time was for testing only.)
29 15 * * * /home/gally/Documents/repos/computer_infrastructure/weather.sh
- Developed a basic workflow in
weather-data.yml
using: - Initially, manually triggering the workflow returned this error:
Process completed with exit code 127.
- Used Crontab Guru to refine the cron syntax in the YAML file.
- Pushed updates but faced the same error. Scheduled runs also failed at the specified time.
- Techielass cron expressions tutorial provided additional insights.
- Ultimately succeeded with a green tick after including both
checkout
and script changes. However, I couldn't determine whether one or both adjustments resolved the issue.
- Focused on enabling the workflow to commit and push weather JSON files to the repository.
- Added
git add .
andgit commit -m
commands to the workflow YAML. Encountered the following error:Author identity unknown Run git config --global user.email "you@example.com" git config --global user.name "Your Name"
- This occurred because the GitHub Actions runner lacked a configured git identity. While I could solve it locally using the commands provided, I needed a more generic solution.
- After configuring the git identity, I successfully added and committed changes but encountered a new error when trying to push:
remote: Permission to CianGallagher/computer_infrastructure.git denied to github-actions[bot].
- Researched and discovered that a GITHUB_TOKEN was needed.
- Added the following to the workflow YAML:
env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- Removed the
GITHUB_TOKEN
secret and instead granted write permissions to the workflow. This resolved the issue, and all tests passed successfully!
By carefully debugging and leveraging resources, I successfully automated the workflow to schedule, execute, and push weather data updates to the repository.
This journey highlights the importance of persistence and leveraging available documentation and tutorials for solving automation challenges.