Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions shared-overwrite/.github/actions/handle-parse-failure/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# ORIGINAL FILE: https://github.com/mtransitapps/commons/tree/master/shared-overwrite
name: MT handle parse failure
description: 'Create a GitHub issue when a parse step fails'
inputs:
step-name:
description: "Name of the failed parse step (e.g. 'MT parse current')"
required: true
run-id:
description: "GitHub Actions run ID"
required: true
github-token:
description: "GitHub token with issue creation permissions"
required: true

runs:
using: "composite"
steps:
- name: MT create issue for failed parse step
shell: bash
run: |
STEP_NAME="${{ inputs.step-name }}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ inputs.run-id }}"
FAILED_LOGS=$(gh run view ${{ inputs.run-id }} --log-failed 2>&1 || echo "Failed to fetch logs")
HOW_TO_FIX="Need to update \`config/gtfs/*.json\` if available or \`agency-parser/src/main/java/org/mtransit/parser/*/*AgencyTools.java\` to fix.
Look at [parser](https://github.com/mtransitapps/parser) repository for available options in [\`src/main/java/org/mtransit/parser/config/gtfs/data/*Config.kt\`](https://github.com/mtransitapps/parser/tree/master/src/main/java/org/mtransit/parser/config/gtfs/data) and [\`src/main/java/org/mtransit/parser/DefaultAgencyTools.java\`](https://github.com/mtransitapps/parser/blob/master/src/main/java/org/mtransit/parser/DefaultAgencyTools.java)
Open a **draft** pull request when ready.
Notify \`@mtransitapps/reviewers\` in the pull request comment"
ISSUE_BODY="## ${STEP_NAME} failed

**Run:** [${STEP_NAME} - ${{ inputs.run-id }}](${RUN_URL})
**Raw logs:** ${RUN_URL} (see failed step)

<details>
<summary>Failed step logs</summary>

\`\`\`
${FAILED_LOGS}
\`\`\`

</details>

## How to fix

${HOW_TO_FIX}"
ISSUE_URL=$(gh issue create \
--title "${STEP_NAME} failed" \
--type "Bug" \
--label "bug" \
--body "${ISSUE_BODY}" \
--assignee "copilot")
gh issue comment "${ISSUE_URL}" --body "@mtransitapps/reviewers please review"
env:
GH_TOKEN: ${{ inputs.github-token }}
18 changes: 18 additions & 0 deletions shared-overwrite/.github/workflows/mt-sync-code-data.yml
Comment thread
mmathieum marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,33 @@ jobs:
echo "Schedule files deletion completed.";

- name: MT parse current
id: mt-parse-current
if: ${{ env.MT_IS_AGENCY_BIKE != 'true' && env.MT_IS_MAIN_REPO != 'true' }}
timeout-minutes: 40
run: ./parse_current.sh

- name: MT parse current failed - create issue
if: ${{ failure() && steps.mt-parse-current.outcome == 'failure' }}
uses: ./.github/actions/handle-parse-failure
with:
step-name: "MT parse current"
run-id: ${{ github.run_id }}
github-token: ${{ secrets.MT_PAT }}

- name: MT parse next
id: mt-parse-next
if: ${{ env.MT_IS_AGENCY_BIKE != 'true' && env.MT_IS_MAIN_REPO != 'true' }}
timeout-minutes: 40
run: ./parse_next.sh

- name: MT parse next failed - create issue
if: ${{ failure() && steps.mt-parse-next.outcome == 'failure' }}
uses: ./.github/actions/handle-parse-failure
with:
step-name: "MT parse next"
run-id: ${{ github.run_id }}
github-token: ${{ secrets.MT_PAT }}

- name: MT parse list change
if: ${{ env.MT_IS_AGENCY_BIKE != 'true' && env.MT_IS_MAIN_REPO != 'true' }}
run: ./parse_list_change.sh
Expand Down