-
Notifications
You must be signed in to change notification settings - Fork 8
56 lines (49 loc) · 1.87 KB
/
preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Create Preview
on:
pull_request_target:
branches: [main]
types: [opened, synchronize, reopened]
jobs:
preview:
name: Preview
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed files in posts folder
id: get_changed_files
uses: tj-actions/changed-files@v44
with:
files: posts/**
json: "true"
- name: get published files cache
if: steps.get_changed_files.outputs.any_changed == 'true'
run: |
git fetch origin processed_files:processed_files
git checkout processed_files -- processed_files.json
- name: Set up Python
if: steps.get_changed_files.outputs.any_changed == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
if: steps.get_changed_files.outputs.any_changed == 'true'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run script to create preview
if: steps.get_changed_files.outputs.any_changed == 'true'
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }}
BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }}
MASTODON_EU_FR_TOKEN: ${{ secrets.MASTODON_EU_FR_TOKEN }}
MATRIX_ACCESS_TOKEN: ${{ secrets.MATRIX_ACCESS_TOKEN }}
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
CHANGED_FILES: ${{ steps.get_changed_files.outputs.all_changed_files }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
run: python -u github_run.py --preview