Skip to content

added more loggin

added more loggin #62

name: Periodic build
on:
schedule:
- cron: 0 0 * * *
push:
branches:
- 'feature/periodic-build-feedback'
jobs:
notify-start:
name: Notify release start
uses: ho-nl/release-slack-action/.github/workflows/notify-slack-start.yml@main
secrets:
slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }}
with:
channel: slack-test-messages
message: Graphcommerce start building
notifyOnlyOnFailure: true
publish:
strategy:
matrix:
version: [18, 20, 22]
runs-on: ubuntu-latest
outputs:
results: ${{ steps.finalize-result.outputs.results }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: graphcommerce
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
registry-url: 'https://registry.npmjs.org'
scope: 'graphcommerce'
- name: Prepare and build graphcommerce
run: |
cp -R graphcommerce/examples/magento-graphcms/. graphcommerce-build
cd graphcommerce-build
corepack enable
yarn kapotmaken # Intentionally causes failure for testing
yarn codegen
yarn build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Collect job result
id: collect-result
run: |
if [ "${{ job.status }}" == "failure" ]; then
echo "Node.js version ${{ matrix.version }}: failed" >> results.txt
else
echo "Node.js version ${{ matrix.version }}: succeeded" >> results.txt
fi
shell: bash
- name: Output job results
id: finalize-result
run: |
cat results.txt
echo "::set-output name=results::$(cat results.txt)"
report-failures:
if: always()
needs: publish
runs-on: ubuntu-latest
outputs:
failed-jobs: ${{ steps.aggregate-failures.outputs.failed-jobs }}
overall-result: ${{ steps.aggregate-failures.outputs.overall-result }}
steps:
- name: Aggregate matrix results
id: aggregate-failures
run: |
echo "Aggregating results..."
echo "${{ needs.publish.outputs.results }}" > matrix-results.txt
failed_jobs=$(grep "failed" matrix-results.txt || true)
if [ -z "$failed_jobs" ]; then
echo "No failed jobs detected."
overall_result="success"
else
echo "Failed jobs detected:"
echo "$failed_jobs"
overall_result="failure"
fi
echo "::set-output name=failed-jobs::$failed_jobs"
echo "::set-output name=overall-result::$overall_result"
test:
if: always()
needs: publish
runs-on: ubuntu-latest
steps:
- name: list rest
run: echo ${{needs.report-failures.outputs.overall-result, needs.report-failures.outputs.failed-jobs }}

Check failure on line 102 in .github/workflows/periodic-build.yml

View workflow run for this annotation

GitHub Actions / Periodic build

Invalid workflow file

The workflow is not valid. .github/workflows/periodic-build.yml (Line: 102, Col: 14): Unexpected symbol: ','. Located at position 45 within expression: needs.report-failures.outputs.overall-result, needs.report-failures.outputs.failed-jobs
notify-end:
if: always()
needs: [notify-start, publish, report-failures]
name: Notify release end
uses: ho-nl/release-slack-action/.github/workflows/notify-slack-end.yml@main
secrets:
slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN }}
with:
time: ${{ needs.notify-start.outputs.time }}
result: ${{ needs.report-failures.outputs.overall-result }}
channel: slack-test-messages
message: |
Periodic build results:
${{ needs.report-failures.outputs.failed-jobs }}
notifyOnlyOnFailure: true