Skip to content

add personal entry of Hauke (#40) #43

add personal entry of Hauke (#40)

add personal entry of Hauke (#40) #43

Workflow file for this run

name: Check Configurations
on: push
jobs:
check-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: install dependencies
run: pip3 install pyyaml
- name: check baseurl
id: baseurl
run: |
import yaml
from pathlib import Path
from configparser import ConfigParser
settings = ConfigParser()
config_path = Path('_config.yml')
settings_path = Path('_action_files/settings.ini')
assert config_path.exists(), 'Did not find _config.yml in the current directory!'
assert settings_path.exists(), 'Did not find _action_files/settings.ini in the current directory!'
settings.read(settings_path)
with open('_config.yml') as f:
config = yaml.safe_load(f)
errmsg = f"The value set for baseurl in _action_files/settings.ini and _config.yml are not identical. Please fix and try again."
assert config['baseurl'] == settings['DEFAULT']['baseurl'], errmsg
shell: python
- name: Create issue if baseurl rule is violated
if: steps.baseurl.outcome == 'failure'
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var err = process.env.ERROR_STRING;
var run_id = process.env.RUN_ID;
github.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Error with repository configuration: baseurl",
body: `${err}\n See run [${run_id}](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}) for more details.`
})
env:
ERROR_STRING: "You have not configured your baseurl correctly, please read the instructions in _config.yml carefully."
RUN_ID: ${{ github.run_id }}