Skip to content

Commit

Permalink
chores: updated and new workflows (update-date.yml)
Browse files Browse the repository at this point in the history
  • Loading branch information
warmachine028 committed Aug 3, 2023
1 parent d1f2cae commit 48278ad
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@2
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -39,11 +39,11 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=14 --statistics --exclude=build
flake8 . --count --exit-zero --max-complexity=14 --statistics --exclude=tests
- name: Type check with mypy
run: |
# --exclude will exclude following folders to avoid duplicates and annoying errors in tests
# --ignore-missing-imports will ignore all missing stub files in imported modules
# mypy . --exclude build --ignore-missing-imports
# mypy . --exclude tests --ignore-missing-imports
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.11.x'
- name: Install dependencies
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/update-date.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Update Date

on:
workflow_dispatch:
push:
paths-ignore:
- '.github/**'

jobs:
publish:
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }} # You need to create your own token with commit rights
ref: ${{ github.ref }} # The branch you want to commit to

- name: Update Files
run: ./.github/workflows/updateDate.sh
shell: bash

- name: Push changes
uses: EndBug/add-and-commit@v9
if: ${{ '<!-- `date "+%d/%m/%y"` -->' != '`tail -n 1 README.md`' }}
with:
committer_name: GitHub Actions
committer_email: actions@github.com
add: .
message: 'docs: Updating Date'
19 changes: 19 additions & 0 deletions .github/workflows/updateDate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

DaySuffix() {
case `date +%d` in
01|21|31) echo "st";;
02|22) echo "nd";;
03|23) echo "rd";;
*) echo "th";;
esac
}

oldDate=`head -n 1 README.md`
newDate=`date "+ updated: %A, %d\`DaySuffix\` %B %Y"`
lastLine='<!-- '`date "+%d/%m/%y"`' -->'

sed -i "1s/.*/$newDate/" README.md
echo Date Updated
sed -i "$ d" README.md
echo $lastLine >> README.md

0 comments on commit 48278ad

Please sign in to comment.