From b09805a8e5266d6e6146517e4084db264aab0f18 Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 09:46:17 +0100 Subject: [PATCH 01/13] Add oldest quarter workflow --- .github/workflows/oldest_quarter.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/oldest_quarter.yml diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml new file mode 100644 index 0000000000..2628299bb3 --- /dev/null +++ b/.github/workflows/oldest_quarter.yml @@ -0,0 +1,19 @@ +name: Oldest Quarter Workflow +on: + schedule: + - cron: '0 0 1 */3 *' +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Run maintenance for outdates files + run: python3 tools/maintenance.py -r 1 + - name: Run find_oldest_quarter.sh + run: tools/find_oldest_quarter.sh + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: oldest-quarter + path: oldest-quarter.csv \ No newline at end of file From 63bfe6925e97a4d2f4c19a36805dd886ca733ccb Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 09:53:22 +0100 Subject: [PATCH 02/13] Update oldest quarter workflow --- .github/workflows/oldest_quarter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 2628299bb3..6bde551b86 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -1,7 +1,7 @@ name: Oldest Quarter Workflow on: schedule: - - cron: '0 0 1 */3 *' + - cron: '0 10 * * *' jobs: build: runs-on: ubuntu-latest From c263399299117eadeeeb135e6cd9a818c7d12b30 Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 10:02:26 +0100 Subject: [PATCH 03/13] Update time --- .github/workflows/oldest_quarter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 6bde551b86..c861299d2f 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -1,7 +1,7 @@ name: Oldest Quarter Workflow on: schedule: - - cron: '0 10 * * *' + - cron: '5 9 * * *' jobs: build: runs-on: ubuntu-latest From a67b5da9e5d6436283e5b771859ff064ac98e720 Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 10:06:46 +0100 Subject: [PATCH 04/13] Add workflow dispatch --- .github/workflows/oldest_quarter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index c861299d2f..576ef59c1d 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -1,5 +1,6 @@ name: Oldest Quarter Workflow on: + workflow_dispatch: schedule: - cron: '5 9 * * *' jobs: From 1a05cc2cc88748e333a82e2af599ea63a2a1adfb Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 10:11:24 +0100 Subject: [PATCH 05/13] Update upload-artifact version --- .github/workflows/oldest_quarter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 576ef59c1d..7b14d1bb44 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -4,7 +4,7 @@ on: schedule: - cron: '5 9 * * *' jobs: - build: + oldest-quarter: runs-on: ubuntu-latest steps: - name: Checkout repository @@ -14,7 +14,7 @@ jobs: - name: Run find_oldest_quarter.sh run: tools/find_oldest_quarter.sh - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: oldest-quarter path: oldest-quarter.csv \ No newline at end of file From 0438eb1c089e51bc422af9901aeca3974dfc6f2f Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 10:13:56 +0100 Subject: [PATCH 06/13] Add requirements step --- .github/workflows/oldest_quarter.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 7b14d1bb44..9ea95d6d01 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -9,6 +9,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Install requirements + run: pip install -r tools/requirements.txt - name: Run maintenance for outdates files run: python3 tools/maintenance.py -r 1 - name: Run find_oldest_quarter.sh From 63918a3295511e565a932fc8ef051e18e695e26f Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 10:16:07 +0100 Subject: [PATCH 07/13] Correct script name --- .github/workflows/oldest_quarter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 9ea95d6d01..13fc68d370 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -13,8 +13,8 @@ jobs: run: pip install -r tools/requirements.txt - name: Run maintenance for outdates files run: python3 tools/maintenance.py -r 1 - - name: Run find_oldest_quarter.sh - run: tools/find_oldest_quarter.sh + - name: Run find-oldest-quarter.sh + run: tools/find-oldest-quarter.sh - name: Upload artifact uses: actions/upload-artifact@v4 with: From 80ee80fbe923a78cee6f50b014ecddab0894f547 Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 13:36:22 +0100 Subject: [PATCH 08/13] Enable debug mode --- .github/workflows/oldest_quarter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 13fc68d370..323d96eea6 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -12,7 +12,7 @@ jobs: - name: Install requirements run: pip install -r tools/requirements.txt - name: Run maintenance for outdates files - run: python3 tools/maintenance.py -r 1 + run: python3 tools/maintenance.py -r 1 --debug - name: Run find-oldest-quarter.sh run: tools/find-oldest-quarter.sh - name: Upload artifact From 6c16deeb35d83235b6522480477c223504700b84 Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 13:41:41 +0100 Subject: [PATCH 09/13] Add ref and fetch depth --- .github/workflows/oldest_quarter.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 323d96eea6..ed5e67c757 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -9,6 +9,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: main - name: Install requirements run: pip install -r tools/requirements.txt - name: Run maintenance for outdates files From 5673bee2e3a39fbdf92e0108566aa8e8c679cfa7 Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 13:45:42 +0100 Subject: [PATCH 10/13] Disable debug mode, add CTA --- .github/workflows/oldest_quarter.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index ed5e67c757..63568f1b52 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -15,11 +15,15 @@ jobs: - name: Install requirements run: pip install -r tools/requirements.txt - name: Run maintenance for outdates files - run: python3 tools/maintenance.py -r 1 --debug + run: python3 tools/maintenance.py -r 1 - name: Run find-oldest-quarter.sh run: tools/find-oldest-quarter.sh - name: Upload artifact uses: actions/upload-artifact@v4 with: name: oldest-quarter - path: oldest-quarter.csv \ No newline at end of file + path: oldest-quarter.csv + - name: Next step + run: | + echo "The content list has been uploaded as an artifact. + Review the content for this quarter by downloading it" \ No newline at end of file From 8d115f04cdddb5070dff3de04e1617bf7897af9e Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 30 Jan 2025 13:58:14 +0100 Subject: [PATCH 11/13] Update cadence --- .github/workflows/oldest_quarter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oldest_quarter.yml b/.github/workflows/oldest_quarter.yml index 63568f1b52..7ff4f15eaf 100644 --- a/.github/workflows/oldest_quarter.yml +++ b/.github/workflows/oldest_quarter.yml @@ -2,7 +2,7 @@ name: Oldest Quarter Workflow on: workflow_dispatch: schedule: - - cron: '5 9 * * *' + - cron: '0 9 * */3 *' jobs: oldest-quarter: runs-on: ubuntu-latest From 6d1529590302848a40582208242bb583517ae83a Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 6 Feb 2025 09:48:19 +0100 Subject: [PATCH 12/13] Update retrieval method of latest changes --- tools/report.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/tools/report.py b/tools/report.py index 8b280c6682..827ca63b71 100644 --- a/tools/report.py +++ b/tools/report.py @@ -19,24 +19,27 @@ "content/learning-paths/automotive"] - - -''' +""" Returns the date (yyyy-mm-dd) which a file in the given directory was last updated. If Learning Path, changes in any file in the directory will count. -''' +""" def get_latest_updated(directory, is_lp, item): article_path = directory if is_lp else f"{directory}/{item}" - date = subprocess.run(["git", "log", "-1" ,"--format=%cs", str(article_path)], stdout=subprocess.PIPE) + process = subprocess.run(["git", "log", "-2" ,"--format=%cs", str(article_path)], stdout=subprocess.PIPE) + dates = process.stdout.decode("utf-8").split("\n") + if dates[0] == "2025-01-09": + date = dates[1] + else: + date = dates[0] return date -''' +""" Recursive content search in a given directory. Returns: - list of articles older than a given period found - count of articles found - list of primary authors found -''' +""" def content_parser(directory, period): count = 0 art_list = {} @@ -55,7 +58,6 @@ def content_parser(directory, period): date = get_latest_updated(directory, is_lp, item) # strip out '\n' and decode byte to string - date = date.stdout.rstrip().decode("utf-8") logging.debug(f"Last updated: {date}") author = "None" for directory_list in open(directory +"/" + item): @@ -91,13 +93,12 @@ def content_parser(directory, period): return [art_list, count, auth_list] - -''' +""" Initialize Plotly data structure for stats 1 graph on the left with data for install tool guides 1 graph on the right with data for learning paths Input: title for the graph -''' +""" def init_graph(title): data = { "data": [ @@ -190,9 +191,9 @@ def init_graph(title): return data -''' +""" Generate JSON data for stats page -''' +""" def stats(): global dname @@ -266,10 +267,10 @@ def stats(): f_contrib.close() -''' +""" List pages older than a period in days and save result as CSV Generate JSON file with data -''' +""" def report(period): global dname From 29e371dab8dec29ccc193443d53f8d56645da5cc Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Thu, 6 Feb 2025 10:31:00 +0100 Subject: [PATCH 13/13] Change default workflow behavior to pass --- .github/workflows/stats-pr.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stats-pr.yml b/.github/workflows/stats-pr.yml index 01f354646f..f414b2eae3 100644 --- a/.github/workflows/stats-pr.yml +++ b/.github/workflows/stats-pr.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-24.04-arm steps: - name: Checkout main branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: main - name: Download stats report as artifact @@ -21,18 +21,30 @@ jobs: # Run ID of the workflow that uploaded the artifact run-id: ${{ github.event.workflow_run.id }} github-token: ${{ github.token }} + - name: Check if artifact exists + run: | + if [ ! -d stats_current_test_info ]; then + echo "No stats artifact found" + echo "ARTIFACT_EXIST=false" >> "$GITHUB_ENV" + else + echo "Stats artifact found" + echo "ARTIFACT_EXIST=true" >> "$GITHUB_ENV" + fi - name: Move stats file # Unpack the artifact and move the stats file to the correct location + if: env.ARTIFACT_EXIST == 'true' run: | mv stats_current_test_info/stats_current_test_info.yml data/stats_current_test_info.yml rm -rf stats_current_test_info - name: Set workflow link as environment variable + if: env.ARTIFACT_EXIST == 'true' run: echo "WORKFLOW_URL=${{ github.event.workflow_run.workflow_url }}" >> $GITHUB_ENV - name: Echo Workflow URL + if: env.ARTIFACT_EXIST == 'true' run: echo $WORKFLOW_URL - name: Create Pull Request uses: peter-evans/create-pull-request@v6 - if: success() + if: env.ARTIFACT_EXIST == 'true' && success() with: commit-message: Update stats_current_test_info.yml title: Update stats_current_test_info.yml