Skip to content

Update Submodules from Upstream #200

Update Submodules from Upstream

Update Submodules from Upstream #200

name: Update Submodules from Upstream
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: update-submodules
cancel-in-progress: true
jobs:
update-submodules:
runs-on: ubuntu-latest
timeout-minutes: 60
# Only run on the main repository, not on forks
if: github.repository == 'RedGuides/readguides'
env:
# Tokens used by update_submodules.py
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}
GITLAB_API_TOKEN: ${{ secrets.GITLAB_API_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: false
- name: Setup SSH agent
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: |
${{ secrets.SUBMODULES_SSH_KEY }}
${{ secrets.READGUIDES_SSH_KEY }}
- name: Configure Git and known_hosts
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global url."git@github.com:".insteadOf "https://github.com/"
git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Initialize submodules
run: |
git submodule sync --recursive
git submodule update --init --recursive
- name: Update submodules from upstream
id: update
run: python automation/update_submodules.py
- name: Post to RedGuides forum
if: steps.update.outputs.new_pr_created == 'true'
uses: RedGuides/redguides-reply@v1
env:
REDGUIDES_API_KEY: ${{ secrets.XF_DONOTREPLY_KEY }}
with:
thread-id: '95078'
message: |
Hi I'm from [URL=${{ steps.update.outputs.script_url }}]update_submodules.py[/URL], [URL=${{ steps.update.outputs.repo_url }}]Read📖Guides[/URL], and I check for updated documentation. Please check my PR: ${{ steps.update.outputs.pr_url }}