Smoke Test (Released Action) #64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Smoke Test (Released Action) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| run: | |
| description: 'workflow run' | |
| required: true | |
| default: 'true' | |
| workflow_run: | |
| workflows: ["Create release"] | |
| types: | |
| - completed | |
| permissions: | |
| contents: write | |
| jobs: | |
| smoke-test-tag-reference: | |
| name: Smoke Test (Tag Reference) | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event_name == 'workflow_dispatch' || | |
| github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Create Test File | |
| run: | | |
| echo "$(date +%s)-$RANDOM" > test/test1.txt | |
| - name: Commit to repository | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| commit_message: test1 ${{ github.run_id }}! | |
| branch: test | |
| repository_path: test | |
| file_pattern: . | |
| tag_name: test1-${{ github.run_id }} | |
| tag_message: test1 ${{ github.run_id }} | |
| tag_reference: v1.0.1 | |
| # pr_labels: "test,automated,tag-reference-test" | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| - name: Confirm Tag Reference | |
| run: | | |
| git show -1 v1.0.1 | |
| git show -1 test1-${{ github.run_id }} | |
| - name: Delete Tag | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| tag_name: test1-${{ github.run_id }} | |
| delete_tag: true | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| smoke-test-auto-branch-false: | |
| name: Smoke Test (Auto Branch False) | |
| needs: [smoke-test-tag-reference] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Commit to repository | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: test | |
| create_pr: true | |
| auto_branch: false | |
| pr_title: test-to-main-pr-title | |
| pr_base: main | |
| pr_branch: test | |
| repository_path: test | |
| file_pattern: . | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_labels: "test,automated,auto-branch-false-test" | |
| smoke-test-auto-branch-true: | |
| name: Smoke Test (Auto Branch True) | |
| needs: [smoke-test-auto-branch-false] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Create Test File | |
| run: | | |
| echo "$(date +%s)-$RANDOM" > test/test-auto-branch.txt | |
| - name: Commit to repository | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: test | |
| create_pr: true | |
| auto_branch: true | |
| pr_base: main | |
| repository_path: test | |
| file_pattern: . | |
| delete_source_branch: true | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_labels: "test,automated,auto-branch-true-test" | |
| smoke-test-skip-if-empty: | |
| name: Smoke Test (Skip If Empty) | |
| runs-on: ubuntu-latest | |
| needs: [smoke-test-auto-branch-true] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 10 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Test Skip If Empty (should skip - no changes) | |
| id: skip-test | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: test | |
| create_pr: true | |
| auto_branch: false | |
| pr_base: main | |
| pr_branch: test | |
| repository_path: test | |
| file_pattern: . | |
| skip_if_empty: true | |
| pr_title: "Test Skip If Empty - No Changes (should skip)" | |
| pr_labels: "test,automated,skip-if-empty-test" | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_closed: true | |
| - name: Verify Skip Output | |
| run: | | |
| echo "skipped=${{ steps.skip-test.outputs.skipped }}" | |
| if [ "${{ steps.skip-test.outputs.skipped }}" != "true" ]; then | |
| echo "FAIL: expected skipped=true" | |
| exit 1 | |
| fi | |
| echo "PASS: skip output verified" | |
| # Verify skip does not happen when changes exist | |
| - name: Create Test File | |
| run: | | |
| echo "$(date +%s)-$RANDOM" > test/skip-test.txt | |
| - name: Test Skip If Empty (should not skip - with changes) | |
| id: no-skip-test | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: test | |
| create_pr: true | |
| auto_branch: true | |
| pr_base: main | |
| repository_path: test | |
| file_pattern: . | |
| skip_if_empty: true | |
| delete_source_branch: true | |
| pr_title: "Test Skip If Empty - With Changes (should not skip)" | |
| pr_labels: "test,automated,skip-if-empty-test" | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_closed: true | |
| - name: Verify No-Skip Output | |
| run: | | |
| echo "skipped=${{ steps.no-skip-test.outputs.skipped }}" | |
| echo "pr_number=${{ steps.no-skip-test.outputs.pr_number }}" | |
| if [ "${{ steps.no-skip-test.outputs.skipped }}" = "true" ]; then | |
| echo "FAIL: expected skipped!=true" | |
| exit 1 | |
| fi | |
| echo "PASS: no-skip output verified" | |
| smoke-test-pr-auto-close: | |
| name: Smoke Test (PR Auto Close) | |
| runs-on: ubuntu-latest | |
| needs: [smoke-test-skip-if-empty] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 10 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Test PR Auto Close | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: test | |
| pr_branch: test | |
| create_pr: true | |
| pr_base: main | |
| repository_path: test | |
| file_pattern: . | |
| pr_closed: true | |
| pr_title: "Test Auto Close PR" | |
| pr_labels: "test,automated,auto-close-pr-body-test" | |
| pr_body: | | |
| ## Test Auto Close PR | |
| This PR will be automatically closed after creation. | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| smoke-test-pr-dry-run: | |
| name: Smoke Test (PR Dry Run) | |
| runs-on: ubuntu-latest | |
| needs: [smoke-test-pr-auto-close] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 10 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Test PR Dry Run (auto_branch false) | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: main | |
| create_pr: true | |
| auto_branch: false | |
| pr_title: "Test PR Dry Run" | |
| pr_base: test | |
| pr_branch: main | |
| pr_labels: "test,automated,dry-run-test" | |
| repository_path: "test" | |
| file_pattern: "pr-dry-run-test.txt" | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_dry_run: true | |
| - name: Test PR Dry Run with Draft | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: main | |
| create_pr: true | |
| auto_branch: false | |
| pr_title: "Test PR Dry Run (Draft)" | |
| pr_base: test | |
| pr_branch: main | |
| pr_labels: "test,automated,draft-pr-test" | |
| repository_path: "test" | |
| file_pattern: "pr-dry-run-test.txt" | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_draft: true | |
| pr_dry_run: true | |
| - name: Test PR Dry Run with Reviewers and Assignees | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| user_email: actions@github.com | |
| user_name: GitHub Actions | |
| branch: main | |
| create_pr: true | |
| auto_branch: false | |
| pr_title: "Test PR Dry Run (Reviewers/Assignees)" | |
| pr_base: test | |
| pr_branch: main | |
| pr_labels: "test,automated,reviewers-test" | |
| pr_reviewers: "somaz94" | |
| pr_assignees: "somaz94" | |
| repository_path: "test" | |
| file_pattern: "pr-dry-run-test.txt" | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| pr_dry_run: true |