Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(deps): update actions/upload-artifact action to v6 #104

chore(deps): update actions/upload-artifact action to v6

chore(deps): update actions/upload-artifact action to v6 #104

name: Test Reusable Workflows
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
paths:
- ".github/workflows/reusable-*.yml"
- "test-scenarios/**"
- ".github/workflows/test-reusable-workflows.yml"
workflow_dispatch:
permissions:
contents: read
pull-requests: write # Needed for add-reviewer workflow
packages: write # Needed for docker workflow
actions: read # Needed for workflow execution
jobs:
# Test Node.js CI with yarn
test-nodejs-ci:
name: Test reusable-nodejs-ci
uses: ./.github/workflows/reusable-nodejs-ci.yml
with:
directorys: "test-scenarios/nodejs-yarn"
disabled-jobs: "depcheck" # Skip depcheck to avoid test failures
check-git-diff: false
# Test Node.js CI with pnpm
test-nodejs-ci-pnpm:
name: Test reusable-nodejs-ci-pnpm
uses: ./.github/workflows/reusable-nodejs-ci-pnpm.yml
with:
directorys: "test-scenarios/nodejs-pnpm"
disabled-jobs: "depcheck" # Skip depcheck to avoid test failures
check-git-diff: false
# Test Maven CI
test-maven:

Check failure on line 44 in .github/workflows/test-reusable-workflows.yml

View workflow run for this annotation

GitHub Actions / Test Reusable Workflows

Invalid workflow file

The workflow is not valid. .github/workflows/test-reusable-workflows.yml (Line: 44, Col: 3): Error calling workflow 'book000/templates/.github/workflows/reusable-maven.yml@a72d62b13478911927c311a1c15d1991dcff0061'. The nested job 'calc-version' is requesting 'contents: write', but is only allowed 'contents: read'. .github/workflows/test-reusable-workflows.yml (Line: 44, Col: 3): Error calling workflow 'book000/templates/.github/workflows/reusable-maven.yml@a72d62b13478911927c311a1c15d1991dcff0061'. The nested job 'build' is requesting 'contents: write', but is only allowed 'contents: read'.
name: Test reusable-maven
uses: ./.github/workflows/reusable-maven.yml
with:
is-merged: false
is-release: false
# Test Actionlint
test-actionlint:
name: Test reusable-actionlint
uses: ./.github/workflows/reusable-actionlint.yml
# Test Hadolint CI
test-hadolint:
name: Test reusable-hadolint-ci
uses: ./.github/workflows/reusable-hadolint-ci.yml
# Test Add Reviewer (only on pull requests to avoid issues)
test-add-reviewer:
name: Test reusable-add-reviewer
if: github.event_name == 'pull_request'
uses: ./.github/workflows/reusable-add-reviewer.yml
with:
actors: "github-actions[bot],test-user"
reviewers: "github-actions[bot]"
# Test Docker workflow (dry run without pushing)
test-docker:
name: Test reusable-docker
uses: ./.github/workflows/reusable-docker.yml
with:
targets: |
[
{
"packageName": "test-package",
"imageName": "test-image",
"context": "test-scenarios/docker",
"file": "test-scenarios/docker/Dockerfile"
}
]
is-merged: false
is-release: false
secrets:
DOCKER_USERNAME: ${{ secrets.GITHUB_ACTOR }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
# Summary job to check all tests passed
test-summary:
name: Test Summary
runs-on: ubuntu-latest
if: always()
needs:
- test-nodejs-ci
- test-nodejs-ci-pnpm
- test-maven
- test-actionlint
- test-hadolint
- test-add-reviewer
- test-docker
steps:
- name: Check test results
run: |
echo "Node.js CI result: ${{ needs.test-nodejs-ci.result }}"
echo "Node.js CI pnpm result: ${{ needs.test-nodejs-ci-pnpm.result }}"
echo "Maven result: ${{ needs.test-maven.result }}"
echo "Actionlint result: ${{ needs.test-actionlint.result }}"
echo "Hadolint result: ${{ needs.test-hadolint.result }}"
echo "Add Reviewer result: ${{ needs.test-add-reviewer.result }}"
echo "Docker result: ${{ needs.test-docker.result }}"
# Check if any job failed (skipped is OK for add-reviewer when not on PR)
if [[ "${{ needs.test-nodejs-ci.result }}" != "success" ]] || \
[[ "${{ needs.test-nodejs-ci-pnpm.result }}" != "success" ]] || \
[[ "${{ needs.test-maven.result }}" != "success" ]] || \
[[ "${{ needs.test-actionlint.result }}" != "success" ]] || \
[[ "${{ needs.test-hadolint.result }}" != "success" ]] || \
[[ "${{ needs.test-add-reviewer.result }}" == "failure" ]] || \
[[ "${{ needs.test-docker.result }}" != "success" ]]; then
echo "❌ Some reusable workflow tests failed!"
exit 1
else
echo "✅ All reusable workflow tests passed!"
fi