Skip to content

test-command

test-command #440

Workflow file for this run

name: test-command
on:
repository_dispatch:
types: [test-command]
jobs:
clean:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Clean up pull requests and branches
- name: Close Pull Requests
uses: ./.github/close-pull-requests
- name: Close Pull Requests
uses: ./.github/close-pull-requests
with:
token: ${{ secrets.TEST_CASE_PAT_ORG }}
repository: create-pull-request/create-pull-request-tests
- name: Close Pull Requests
uses: ./.github/close-pull-requests
with:
token: ${{ secrets.TEST_CASE_PAT_ORG }}
repository: create-pull-request/create-pull-request-tests-remote-private
# Delete the test branches created in the fork
- uses: actions/checkout@v4
with:
token: ${{ secrets.CPR_MACHINE_USER_TOKEN }}
repository: create-pull-request-machine-user/create-pull-request-tests
ref: master
path: create-pull-request-machine-user-fork
- name: Delete fork branches
working-directory: create-pull-request-machine-user-fork
run: |
git fetch
git push --force --delete origin refs/heads/tests/push-branch-to-fork || true
git push --force --delete origin refs/heads/tests/push-branch-to-fork-via-ssh || true
beforeTest:
needs: clean
runs-on: ubuntu-latest
outputs:
sign-commits: ${{ steps.vars.outputs.sign-commits }}
perf: ${{ steps.vars.outputs.perf }}
steps:
# Get the target repository and ref
- name: Get the target repository and ref
id: vars
run: |
repository=${{ github.event.client_payload.slash_command.args.named.repository }}
if [[ -z "$repository" ]]; then repository="peter-evans/create-pull-request"; fi
echo "repository=$repository" >> $GITHUB_OUTPUT
ref=${{ github.event.client_payload.slash_command.args.named.ref }}
if [[ -z "$ref" ]]; then ref="main"; fi
echo "ref=$ref" >> $GITHUB_OUTPUT
build=${{ github.event.client_payload.slash_command.args.named.build }}
if [[ -z "$build" ]]; then build="false"; fi
echo "build=$build" >> $GITHUB_OUTPUT
sign_commits=${{ github.event.client_payload.slash_command.args.named.sign-commits }}
if [[ -z "$sign_commits" ]]; then sign_commits="false"; fi
echo "sign-commits=$sign_commits" >> $GITHUB_OUTPUT
perf=${{ github.event.client_payload.slash_command.args.named.perf }}
if [[ -z "$perf" ]]; then perf="false"; fi
echo "perf=$perf" >> $GITHUB_OUTPUT
# Checkout the ref to test
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ steps.vars.outputs.repository }}
ref: ${{ steps.vars.outputs.ref }}
# Build
- if: steps.vars.outputs.build == 'true'
uses: actions/setup-node@v4
with:
node-version: 16.x
- if: steps.vars.outputs.build == 'true'
run: |
npm ci
npm run build
npm run format-check
npm run lint
npm run test
rm -rf node_modules
# Create an artifact from the action
- uses: actions/upload-artifact@v4
with:
name: create-pull-request
path: .
createRunLink:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Update comment
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
> [Command run output][1]
[1]: ${{ steps.vars.outputs.run-url }}
testCreate:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Add a symlink to report.txt
run: ln -s report.txt report-symlink
- name: Add a submodule
run: git submodule add https://github.com/peter-evans/blog
- name: Create a large file
run: truncate -s 39M largefile # 40MiB max
- name: Create 1000 1KB files
if: needs.beforeTest.outputs.perf == 'true'
run: |
for i in {1..1000}; do
head -c 1024 /dev/urandom | base64 > "file_$i"
done
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
commit-message: |
Add report file
This is a test commit message body.
You can use multiple lines.
Some JSON:
{
"test": "test",
"test2": "test2"
}
committer: GitHub <noreply@github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
title: '[Example] Add report file'
body: |
New report
- Contains *today's* date
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: |
report
automated pr
assignees: peter-evans
reviewers: peter-evans
milestone: 1
branch: tests/branch/create-update
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
# # Create a project card
# - name: Create or Update Project Card
# uses: peter-evans/create-or-update-project-card@v3
# with:
# project-name: Example Project
# column-name: To do
# issue-number: ${{ steps.cpr.outputs.pull-request-number }}
# Add a label (to test that it won't be removed on update)
- name: Add label
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.cpr.outputs.pull-request-number }},
labels: ['will-not-be-removed']
})
testUpdate:
needs: [beforeTest, testCreate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Add a symlink to report.txt
run: ln -s report.txt report-symlink
- name: Add a submodule
run: git submodule add https://github.com/peter-evans/blog
- name: Create a large file
run: truncate -s 39M largefile # 40MiB max
- name: Create 1000 1KB files
if: needs.beforeTest.outputs.perf == 'true'
run: |
for i in {1..1000}; do
head -c 1024 /dev/urandom | base64 > "file_$i"
done
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
commit-message: |
Add report file
This is a test commit message body.
You can use multiple lines.
Some JSON:
{
"test": "test",
"test2": "test2"
}
committer: GitHub <noreply@github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
title: '[Example] Add report file (updated)'
body-path: .github/pull-request-body.md
labels: |
report
automated pr
assignees: peter-evans
reviewers: peter-evans
milestone: 1
branch: tests/branch/create-update
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'updated'
if: steps.cpr.outputs.pull-request-operation != 'updated'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
# # Update the project card
# - name: Create or Update Project Card
# uses: peter-evans/create-or-update-project-card@v3
# with:
# project-name: Example Project
# column-name: To do
# issue-number: ${{ steps.cpr.outputs.pull-request-number }}
testIdenticalChangeCreate:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: echo "some data" > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testIdenticalChange
branch: tests/branch/identical-change
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testIdenticalChangeUpdate:
needs: [beforeTest, testIdenticalChangeCreate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: echo "some data" > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testIdenticalChange
branch: tests/branch/identical-change
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'none'
if: steps.cpr.outputs.pull-request-operation != 'none'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testNoDiffCreate:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testNoDiff
branch: tests/branch/no-diff
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testNoDiffUpdate:
needs: [beforeTest, testNoDiffCreate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
# Running with no update effectively reverts the branch back to match the base
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testNoDiff
branch: tests/branch/no-diff
delete-branch: true
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'closed'
if: steps.cpr.outputs.pull-request-operation != 'closed'
run: exit 1
testCommitsOnBaseCreate:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Create test base branch
- name: Create test base
run: |
git config user.name 'CPR Test User'
git config user.email 'cpr-test-user@users.noreply.github.com'
git push --force origin HEAD:refs/heads/tests/base/commits-on-base
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCommitsOnBase
branch: tests/branch/commits-on-base
base: tests/base/commits-on-base
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCommitsOnBaseCommit:
needs: [beforeTest, testCommitsOnBaseCreate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: tests/base/commits-on-base
# Create commits on the test base branch
- name: Create commits
run: |
git config user.name 'CPR Test User'
git config user.email 'cpr-test-user@users.noreply.github.com'
date +%s > report.txt
git commit -am "Commit on base 1"
date +%s > new-report.txt
git add -A
git commit -m "Commit on base 2"
git push
testCommitsOnBaseUpdate:
needs: [beforeTest, testCommitsOnBaseCommit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: tests/base/commits-on-base
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCommitsOnBase
branch: tests/branch/commits-on-base
base: tests/base/commits-on-base
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'updated'
if: steps.cpr.outputs.pull-request-operation != 'updated'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCommitsOnWorkingBase:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create commits
run: |
git config user.name 'CPR Test User'
git config user.email 'cpr-test-user@users.noreply.github.com'
date +%s > report.txt
git commit -am "Commit during workflow 1"
# Test empty commits
git commit --allow-empty -m "Commit during workflow 2"
date +%s > new-report.txt
git add -A
git commit -m "Commit during workflow 3"
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCommitsOnWorkingBase
branch: tests/branch/commits-on-working-base
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testWorkingBaseNotBaseSetup:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Create test base branch
- name: Create test base
run: |
git config user.name 'CPR Test User'
git config user.email 'cpr-test-user@users.noreply.github.com'
date +%s > report.txt
git commit -am "This commit should not appear in pr branches"
git push --force origin HEAD:refs/heads/tests/base/working-base-not-base
testWorkingBaseNotBaseCreate:
needs: [beforeTest, testWorkingBaseNotBaseSetup]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: tests/base/working-base-not-base
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testWorkingBaseNotBase
branch: tests/branch/working-base-not-base
base: master
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testDetachedHeadCreate:
needs: beforeTest
runs-on: ubuntu-latest
steps:
# Checkout the HEAD commit to put in detached HEAD state
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testDetachedHeadCreateUpdate
branch: tests/detached-head
base: master
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testDetachedHeadUpdate:
needs: [beforeTest, testDetachedHeadCreate]
runs-on: ubuntu-latest
steps:
# Checkout the HEAD commit to put in detached HEAD state
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testDetachedHeadCreateUpdate
branch: tests/detached-head
base: master
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'updated'
if: steps.cpr.outputs.pull-request-operation != 'updated'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCreateOnUpToDateBranchFirst:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: echo "test data" > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCreateOnUpToDateBranchFirst
branch: tests/create-on-up-to-date-branch
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
# Close the PR but don't delete the branch
- name: Close Pull
uses: peter-evans/close-pull@v3
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
comment: 'Closing PR but not deleting the branch'
delete-branch: false
testCreateOnUpToDateBranchSecond:
needs: [beforeTest, testCreateOnUpToDateBranchFirst]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: echo "test data" > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCreateOnUpToDateBranchSecond
branch: tests/create-on-up-to-date-branch
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testMultiPlatform:
needs: beforeTest
name: testCreateMultiPlatform on ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
run: date +%s > report.txt
- name: Create report file (windows)
if: matrix.platform == 'windows-latest'
run: echo %DATE% %TIME% > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
committer: Peter Evans <peter-evans@users.noreply.github.com>
title: testMultiPlatform on ${{ matrix.platform }}
branch: tests/multi-platform
branch-suffix: random
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testSetAuthorCommitter:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testSetAuthorCommitter
author: 'CPR Test Author <cpr-test-author@users.noreply.github.com>'
committer: 'CPR Test Committer <cpr-test-committer@users.noreply.github.com>'
branch: tests/set-author-committer
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testSetSignoff:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testSetSignoff
author: 'CPR Test Author <cpr-test-author@users.noreply.github.com>'
committer: 'CPR Test Committer <cpr-test-committer@users.noreply.github.com>'
signoff: true
branch: tests/set-signoff
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testAddPaths:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report files
run: |
date +%s > temp.txt
date +%s > data.dat
mkdir -p reports
date +%s > reports/report1.txt
date +%s > reports/report2.txt
date +%s > reports/report3.txt
date +%s > reports/temp.txt
date +%s > reports/data.dat
- name: Create Pull Request
id: cpr1
uses: ./create-pull-request-local
with:
add-paths: |
reports/report*.txt
*.dat
title: testAddPaths1
branch: tests/add-paths-1
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr1.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr1.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr1.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
- name: Create Pull Request
id: cpr2
uses: ./create-pull-request-local
with:
add-paths: |
*.txt
title: testAddPaths2
branch: tests/add-paths-2
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr2.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr2.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr2.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCreateDraft:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCreateUpdateDraft
branch: tests/create-update-draft
draft: true
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
# Mark the PR as ready for review to test 'draft: always-true'
- name: Mark PR ready for review
run: gh pr ready "${{ steps.cpr.outputs.pull-request-url }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
testUpdateDraft:
needs: [beforeTest, testCreateDraft]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCreateUpdateDraft
branch: tests/create-update-draft
draft: always-true
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'updated'
if: steps.cpr.outputs.pull-request-operation != 'updated'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCreateWithPAT:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ secrets.TEST_CASE_PAT }}
title: testCreateUpdateWithPAT
branch: tests/create-update-with-pat
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != 'false'
run: exit 1
testUpdateWithPAT:
needs: [beforeTest, testCreateWithPAT]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ secrets.TEST_CASE_PAT }}
title: testCreateUpdateWithPAT
branch: tests/create-update-with-pat
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'updated'
if: steps.cpr.outputs.pull-request-operation != 'updated'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != 'false'
run: exit 1
testCreateWithBranchTokenPAT:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
branch-token: ${{ secrets.TEST_CASE_PAT }}
title: testCreateWithBranchTokenPAT
branch: tests/create-with-branch-token-pat
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != 'false'
run: exit 1
testCreateInRemoteRepo:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.CPR_AUTH_APP_ID }}
private-key: ${{ secrets.CPR_AUTH_APP_PRIVATE_KEY }}
owner: create-pull-request
repositories: create-pull-request-tests
- name: Set token when sign-commits is false
if: needs.beforeTest.outputs.sign-commits == 'false'
run: echo "token=${{ secrets.TEST_CASE_PAT_ORG }}" >> $GITHUB_ENV
- name: Set token when sign-commits is true
if: needs.beforeTest.outputs.sign-commits == 'true'
run: echo "token=${{ steps.generate_token.outputs.token }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
repository: create-pull-request/create-pull-request-tests
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ env.token }}
title: testCreateInRemoteRepo
branch: tests/create-in-remote-repo
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCreateInRemotePrivateRepo:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.CPR_AUTH_APP_ID }}
private-key: ${{ secrets.CPR_AUTH_APP_PRIVATE_KEY }}
owner: create-pull-request
repositories: create-pull-request-tests-remote-private
- name: Set token when sign-commits is false
if: needs.beforeTest.outputs.sign-commits == 'false'
run: echo "token=${{ secrets.TEST_CASE_PAT_ORG }}" >> $GITHUB_ENV
- name: Set token when sign-commits is true
if: needs.beforeTest.outputs.sign-commits == 'true'
run: echo "token=${{ steps.generate_token.outputs.token }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
token: ${{ env.token }}
repository: create-pull-request/create-pull-request-tests-remote-private
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ env.token }}
title: testCreateInRemotePrivateRepo
branch: tests/create-in-remote-private-repo
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCreateWithRelativePath:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: relative-path
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
working-directory: relative-path
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
path: relative-path
title: testCreateWithRelativePath
branch: tests/create-with-relative-path
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testPushLFSTrackedFile:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create LFS tracked file
run: |
git lfs track "*.dat"
date +%s > large_file.dat
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testPushLFSTrackedFile
branch: tests/push-lfs-tracked-file
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testCreateBranchViaSSH:
needs: beforeTest
runs-on: ubuntu-latest
steps:
# Checkout via SSH
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testCreateBranchViaSSH
branch: tests/create-branch-via-ssh
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testPushBranchToForkCreate:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.CPR_AUTH_APP_ID }}
private-key: ${{ secrets.CPR_AUTH_APP_PRIVATE_KEY }}
owner: create-pull-request
repositories: create-pull-request-tests
- name: Set token when sign-commits is false
if: needs.beforeTest.outputs.sign-commits == 'false'
run: |
echo "token=${{ secrets.CPR_MACHINE_USER_TOKEN }}" >> $GITHUB_ENV
echo "branch_token=${{ secrets.CPR_MACHINE_USER_TOKEN }}" >> $GITHUB_ENV
echo "push_to_fork=create-pull-request-machine-user/create-pull-request-tests" >> $GITHUB_ENV
echo "maintainer_can_modify=true" >> $GITHUB_ENV
- name: Set token when sign-commits is true
if: needs.beforeTest.outputs.sign-commits == 'true'
run: |
echo "token=${{ github.token }}" >> $GITHUB_ENV
echo "branch_token=${{ steps.generate_token.outputs.token }}" >> $GITHUB_ENV
echo "push_to_fork=create-pull-request/create-pull-request-tests" >> $GITHUB_ENV
echo "maintainer_can_modify=false" >> $GITHUB_ENV
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ env.token }}
branch-token: ${{ env.branch_token }}
title: testPushBranchToFork
branch: tests/push-branch-to-fork
push-to-fork: ${{ env.push_to_fork }}
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
maintainer-can-modify: ${{ env.maintainer_can_modify }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testPushBranchToForkUpdate:
needs: [beforeTest, testPushBranchToForkCreate]
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.CPR_AUTH_APP_ID }}
private-key: ${{ secrets.CPR_AUTH_APP_PRIVATE_KEY }}
owner: create-pull-request
repositories: create-pull-request-tests
- name: Set token when sign-commits is false
if: needs.beforeTest.outputs.sign-commits == 'false'
run: |
echo "token=${{ secrets.CPR_MACHINE_USER_TOKEN }}" >> $GITHUB_ENV
echo "branch_token=${{ secrets.CPR_MACHINE_USER_TOKEN }}" >> $GITHUB_ENV
echo "push_to_fork=create-pull-request-machine-user/create-pull-request-tests" >> $GITHUB_ENV
echo "maintainer_can_modify=true" >> $GITHUB_ENV
- name: Set token when sign-commits is true
if: needs.beforeTest.outputs.sign-commits == 'true'
run: |
echo "token=${{ github.token }}" >> $GITHUB_ENV
echo "branch_token=${{ steps.generate_token.outputs.token }}" >> $GITHUB_ENV
echo "push_to_fork=create-pull-request/create-pull-request-tests" >> $GITHUB_ENV
echo "maintainer_can_modify=false" >> $GITHUB_ENV
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ env.token }}
branch-token: ${{ env.branch_token }}
title: testPushBranchToFork
branch: tests/push-branch-to-fork
push-to-fork: ${{ env.push_to_fork }}
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
maintainer-can-modify: ${{ env.maintainer_can_modify }}
# Check outputs
- name: Check the operation is 'updated'
if: steps.cpr.outputs.pull-request-operation != 'updated'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testPushBranchToForkWithFineGrainedPAT:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
branch-token: ${{ secrets.CPR_MACHINE_USER_FG_TOKEN }}
title: testPushBranchToForkWithFineGrainedPAT
branch: tests/push-branch-to-fork-with-fine-grained-pat
push-to-fork: create-pull-request-machine-user/create-pull-request-tests
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
maintainer-can-modify: false
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != 'false'
run: exit 1
testPushBranchToForkViaSSH:
needs: beforeTest
runs-on: ubuntu-latest
steps:
# Note: This combination is proof of concept but is probably not
# something anyone would want to do because you still need a PAT
# for the machine user to create the pull request.
#
# If the base repository is private then a deploy key may need to
# be created with read access for checkout. The same deploy key in
# the fork needs write access.
# Checkout via SSH
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.CPR_MACHINE_USER_SSH_PRIVATE_KEY }}
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ secrets.CPR_MACHINE_USER_TOKEN }}
title: testPushBranchToForkViaSSH
branch: tests/push-branch-to-fork-via-ssh
push-to-fork: create-pull-request-machine-user/create-pull-request-tests
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != 'false'
run: exit 1
testPushBranchToForkWithSiblingBase:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: create-pull-request/create-pull-request-tests
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ secrets.CPR_MACHINE_USER_TOKEN }}
title: testPushBranchToForkWithSiblingBase
branch: tests/push-branch-to-fork-with-sibling-base
push-to-fork: create-pull-request-machine-user/create-pull-request-tests
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != 'false'
run: exit 1
testCreateWithGpgSignedCommit:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
committer: actions-bot <actions-bot@users.noreply.github.com>
title: testCreateWithGpgSignedCommits
branch: tests/create-with-gpg-signed-commit
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified == needs.beforeTest.outputs.sign-commits
run: exit 1
testAlpineContainer:
needs: beforeTest
runs-on: ubuntu-latest
container:
image: alpine
steps:
- name: Install dependencies
run: apk --no-cache add git
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testAlpineContainer
branch: tests/alpine-container
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testUbuntuContainer:
needs: beforeTest
runs-on: ubuntu-latest
container:
image: ubuntu
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt-get install -y git
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testUbuntuContainer
branch: tests/ubuntu-container
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testProxySupport:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
- name: Start proxy
run: |
docker run -d -p 8443:8443 --name proxy peterevans/forward-proxy
- name: Setup firewall rules
run: |
sudo apt-get update
sudo apt-get install -y ufw
PROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' proxy)
sudo ufw default deny outgoing
sudo ufw allow out to any port 8443
sudo ufw allow out from $PROXY_IP
sudo ufw enable
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testProxySupport
branch: tests/proxy-support
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
env:
https_proxy: http://localhost:8443
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
testNoProxySupport:
needs: beforeTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Download the action artifact
- uses: actions/download-artifact@v4
with:
name: create-pull-request
path: create-pull-request-local
# Test
- name: Create report file
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: ./create-pull-request-local
with:
title: testNoProxySupport
branch: tests/no-proxy-support
sign-commits: ${{ needs.beforeTest.outputs.sign-commits }}
env:
https_proxy: http://localhost:8
no_proxy: .github.com
# Check outputs
- name: Check the operation is 'created'
if: steps.cpr.outputs.pull-request-operation != 'created'
run: exit 1
- name: Check a pull request number exists
if: steps.cpr.outputs.pull-request-number == ''
run: exit 1
- name: Check the verification status of commits
if: steps.cpr.outputs.pull-request-commits-verified != needs.beforeTest.outputs.sign-commits
run: exit 1
afterTest:
needs:
- createRunLink
- testUpdate
- testIdenticalChangeUpdate
- testNoDiffUpdate
- testCommitsOnBaseUpdate
- testCommitsOnWorkingBase
- testWorkingBaseNotBaseCreate
- testDetachedHeadUpdate
- testCreateOnUpToDateBranchSecond
- testMultiPlatform
- testSetAuthorCommitter
- testSetSignoff
- testAddPaths
- testUpdateDraft
- testUpdateWithPAT
- testCreateWithBranchTokenPAT
- testCreateInRemoteRepo
- testCreateInRemotePrivateRepo
- testCreateWithRelativePath
- testCreateBranchViaSSH
- testPushBranchToForkUpdate
- testPushBranchToForkWithFineGrainedPAT
- testPushBranchToForkViaSSH
- testPushBranchToForkWithSiblingBase
- testPushLFSTrackedFile
- testCreateWithGpgSignedCommit
- testAlpineContainer
- testUbuntuContainer
- testProxySupport
- testNoProxySupport
runs-on: ubuntu-latest
steps:
# Add reaction to the comment
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: hooray