Skip to content

Publish PR

Publish PR #64

Workflow file for this run

{
"jobs": {
"publish": {
"runs-on": "ubuntu-22.04",
"steps": [
{
"with": {
"repository": "lukebemish/artifact-sync",
"ref": "refs/heads/main",
"persist-credentials": false
},
"name": "Checkout Artifact Sync",
"uses": "actions/checkout@v4"
},
{
"run": "mkdir repo"
},
{
"with": {
"script": "const response = await github.rest.search.issuesAndPullRequests({\n q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',\n per_page: 1,\n})\nconst items = response.data.items\nif (items.length < 1) {\n console.error('No PRs found')\n return\n}\nconst pullRequestNumber = items[0].number\nlet allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({\n owner: context.repo.owner,\n repo: context.repo.repo,\n run_id: context.payload.workflow_run.id,\n});\nlet matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {\n return artifact.name == \"artifacts\"\n})[0];\nlet download = await github.rest.actions.downloadArtifact({\n owner: context.repo.owner,\n repo: context.repo.repo,\n artifact_id: matchArtifact.id,\n archive_format: 'zip',\n});\nlet fs = require('fs');\nfs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data));\nreturn pullRequestNumber;"
},
"name": "Download Artifacts",
"uses": "actions/github-script@v7",
"id": "download_artifacts"
},
{
"name": "Unpack Artifacts",
"run": "unzip repo.zip -d repo"
},
{
"name": "Publish Artifacts",
"run": "python3 run.py",
"env": {
"MAVEN_USER": "github",
"MAVEN_PASSWORD": "${{ secrets.PR_MAVEN_PASSWORD }}",
"MAVEN_URL": "https://maven.lukebemish.dev/pullrequests/",
"ALLOWED_VERSION": "*-pr${{ steps.download_artifacts.outputs.result }}",
"ALLOWED_PATHS": "dev/lukebemish/codecextras"
}
}
],
"if": "${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}"
}
},
"name": "Publish PR",
"concurrency": "ci-${{ github.ref }}",
"on": {
"workflow_run": {
"types": [
"completed"
],
"workflows": [
"Build PR"
]
}
}
}