Skip to content

Commit e2c5370

Browse files
committed
prepared pipeline for testing
1 parent dba8182 commit e2c5370

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# TEMPORARY fork-test copy of run_blog_exporter.yml.
2+
# Differences from the real workflow (so it can run on a personal fork):
3+
# - guard points at the fork instead of the org repo
4+
# - manual trigger only (no daily schedule)
5+
# - uses the built-in GITHUB_TOKEN to open the PR (no org PAT needed)
6+
# - no team-reviewers (that team doesn't exist on a fork)
7+
# DELETE this file once you've finished testing; the real pipeline is
8+
# run_blog_exporter.yml.
9+
name: Publish reviewed blogs (fork test)
10+
11+
on:
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
publish-blogs:
20+
if: github.repository == 'nora-weisser/WomenCodingCommunity.github.io'
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v5
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.12'
31+
32+
- name: Cache pip
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.cache/pip
36+
key: ${{ runner.os }}-pip-blog-${{ hashFiles('tools/blog_automation/requirements.txt') }}
37+
restore-keys: |
38+
${{ runner.os }}-pip-blog-
39+
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install -r tools/blog_automation/requirements.txt
44+
45+
- name: Write service account key
46+
run: echo "$SERVICE_ACCOUNT_KEY" > tools/blog_automation/service_account_key.json
47+
env:
48+
SERVICE_ACCOUNT_KEY: ${{ secrets.BLOG_AUTOMATION_SERVICE_ACCOUNT }}
49+
50+
- name: Export reviewed blogs
51+
run: |
52+
cd tools/blog_automation
53+
python publish_reviewed_blogs.py
54+
55+
- name: Remove service account key
56+
if: always()
57+
run: rm -f tools/blog_automation/service_account_key.json
58+
59+
- name: Create or Update Pull Request
60+
id: create-pr
61+
uses: peter-evans/create-pull-request@v7
62+
with:
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
commit-message: "Automated import of reviewed blog posts"
65+
branch: "automation/import-blog"
66+
title: "Automated import of reviewed blog posts"
67+
body: |
68+
This PR was created automatically by a GitHub Action (fork test).
69+
70+
It contains every blog marked `isReviewedandApproved` (and not yet
71+
`isPublished`) in the submissions spreadsheet:
72+
- new posts under `_posts/`
73+
- cover images under `assets/images/blog/`
74+
75+
The spreadsheet's `isPublished` column has already been set to TRUE for
76+
these rows.
77+
labels: |
78+
automation
79+
add-paths: |
80+
_posts/**
81+
assets/images/blog/**

0 commit comments

Comments
 (0)