mirror of
https://github.com/th30d4y/OpenLearnX.git
synced 2026-05-26 19:26:33 +00:00
Merge pull request #8 from th30d4y/copilot/fix-mirror-event-log
Make event-mirroring workflow non-fatal when `LOGS_REPO_PAT` is unset
This commit is contained in:
@@ -24,15 +24,19 @@ jobs:
|
|||||||
LOG_ROOT_DIR: openlearnx-events
|
LOG_ROOT_DIR: openlearnx-events
|
||||||
steps:
|
steps:
|
||||||
- name: Ensure personal access token exists
|
- name: Ensure personal access token exists
|
||||||
|
id: ensure_pat
|
||||||
env:
|
env:
|
||||||
LOGS_REPO_PAT: ${{ secrets.LOGS_REPO_PAT }}
|
LOGS_REPO_PAT: ${{ secrets.LOGS_REPO_PAT }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$LOGS_REPO_PAT" ]; then
|
if [ -z "$LOGS_REPO_PAT" ]; then
|
||||||
echo "Missing required secret: LOGS_REPO_PAT. See README.md for setup instructions."
|
echo "::warning::Missing required secret: LOGS_REPO_PAT. Skipping event mirroring. See README.md for setup instructions."
|
||||||
exit 1
|
echo "has_pat=false" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "has_pat=true" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Checkout logs repository
|
- name: Checkout logs repository
|
||||||
|
if: steps.ensure_pat.outputs.has_pat == 'true'
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
with:
|
with:
|
||||||
repository: th30d4y/LOGS
|
repository: th30d4y/LOGS
|
||||||
@@ -40,6 +44,7 @@ jobs:
|
|||||||
path: logs-repo
|
path: logs-repo
|
||||||
|
|
||||||
- name: Append event payload to daily log file
|
- name: Append event payload to daily log file
|
||||||
|
if: steps.ensure_pat.outputs.has_pat == 'true'
|
||||||
env:
|
env:
|
||||||
SOURCE_REPOSITORY: ${{ github.repository }}
|
SOURCE_REPOSITORY: ${{ github.repository }}
|
||||||
SOURCE_EVENT_NAME: ${{ github.event_name }}
|
SOURCE_EVENT_NAME: ${{ github.event_name }}
|
||||||
@@ -98,6 +103,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit and push logs
|
- name: Commit and push logs
|
||||||
|
if: steps.ensure_pat.outputs.has_pat == 'true'
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd logs-repo
|
cd logs-repo
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ Add this repository secret in **OpenLearnX**:
|
|||||||
- `LOGS_REPO_PAT`: a Personal Access Token that can write to `th30d4y/LOGS`.
|
- `LOGS_REPO_PAT`: a Personal Access Token that can write to `th30d4y/LOGS`.
|
||||||
- Fine-grained PAT: grant repository access to `th30d4y/LOGS` with **Contents: Read and write**.
|
- Fine-grained PAT: grant repository access to `th30d4y/LOGS` with **Contents: Read and write**.
|
||||||
- Classic PAT: use **repo** scope.
|
- Classic PAT: use **repo** scope.
|
||||||
|
- If this secret is missing, the workflow now exits successfully and skips mirroring with a warning message.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user