Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
8298c84342
Bump node-fetch from 2.6.1 to 2.6.7 in /.github/actions/test-action
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 14:47:52 +00:00
7 changed files with 77 additions and 179 deletions

View File

@ -156,11 +156,22 @@
}
},
"node_modules/node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/once": {
@ -171,6 +182,11 @@
"wrappy": "1"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
@ -184,6 +200,20 @@
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@ -326,9 +356,12 @@
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": {
"whatwg-url": "^5.0.0"
}
},
"once": {
"version": "1.4.0",
@ -338,6 +371,11 @@
"wrappy": "1"
}
},
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
@ -348,6 +386,20 @@
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",

View File

@ -1,10 +1,14 @@
// assign a milestone to issues or PRs added to a project, with a name corresponding
// to the name of the project - create the milestone if it does not exist
//
// adding a *second* project to the issue will update the milestone accordingly
// removing that project will reset the milestone entirely (not use the other project)
// and, no idea what happens if one very quickly adds and removes an issue
//
// get the project
// check if the name matches a version x.y or x.y.z
// created
// check that there is a corresponding milestone
// else create that milestone
// and assign the issue to the milestone
// deleted
// get the issue
// if issue is not closed,
// remove issue from milestone, if any
// an issue or PR actually becomes a card (or, a card is actually created...) when
// it's move to a project column for the first time - being assigned to the project
// and showing in project's backlog is not enough.

View File

@ -1,7 +1,6 @@
module.exports = /*async*/ ({github, context, core}) => {
module.exports = async ({github, context, core}) => {
const restapi = github.rest
var dryrun = context.payload.inputs.dryrun
function firstOrDefault(items, predicate) {
for (const item of items) {
@ -11,127 +10,6 @@ module.exports = /*async*/ ({github, context, core}) => {
}
return null
}
async function validateRelease() {
const version = context.payload.inputs.version
const tag = "v" + version
console.log(`Validate version '${version}'.`)
// git branch must exist
const branchRefs = await restapi.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/release/${version}`
})
if (firstOrDefault(branchRefs.data, (x) => x.ref == `refs/heads/release/${version}`) == null) {
core.setFailed(`Could not find branch 'release/${version}'.`)
return
}
console.log(`Found branch 'release/${version}'.`)
// github milestone must exist and be open
const milestone = await getMilestone()
if (milestone == null) {
core.setFailed(`Could not find milestone '${version}'.`)
return
}
if (milestone.state != "open") {
core.setFailed(`Milestone '${version}' is already closed.`)
return
}
console.log(`Found open milestone '${version}'.`)
// github release must exist and not be published yet
const release = await getRelease()
if (release === null) {
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`)
return
}
if (!release.draft) {
core.setFailed(`GitHub release for tag '${tag}' is already published.`)
return
}
console.log(`Found yet-unpublished GitHub release for tag '${tag}'.`)
// tag must not exist
const tagRefs = await restapi.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tag}`
})
if (firstOrDefault(tagRefs.data, (x) => x.ref == `tags/${tag}`) != null) {
core.setFailed(`Tag '${tag}' already exists.`)
return
}
console.log(`Verified that tag '${tag}' does not exist yet.`)
console.log('Release is valid.')
}
async function publishRelease() {
const version = context.payload.inputs.version
const tag = "v" + version
console.log(`Publish GitHub release '${version}'.`)
const release = await getRelease()
await restapi.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
draft: false
})
}
async function closeMilestone() {
const version = context.payload.inputs.version
const tag = "v" + version
console.log(`Close milestone '${version}'.`)
const milestone = await getMilestone()
await restapi.issues.updateMilestone({
owner: context.repo.owner,
repo: context.repo.repo,
milestone_number: milestone.number,
state: "closed"
})
}
async function getRelease() {
// note: getReleaseByTag only returns published releases
// note: we may eventually need to paginate
// and then releases.headers should contain what we need?
// https://octokit.github.io/rest.js/v18#pagination
const version = context.payload.inputs.version
const tag = `v${version}`
const releases = await restapi.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
})
const release = firstOrDefault(releases.data, (x) => x.tag_name == tag)
return release
}
async function getMilestone() {
const version = context.payload.inputs.version
const milestonesResponse = await restapi.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo
})
const milestones = milestonesResponse.data
return firstOrDefault(milestones, (x) => x.title == version)
}
return {
validateRelease: validateRelease,
publishRelease: publishRelease,
closeMilestone: closeMilestone
}
console.log("script")
}

View File

@ -1,46 +1,14 @@
name: Publish Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
dryrun:
description: 'DryRun'
required: true
type: boolean
default: true
on: workflow_dispatch
jobs:
job:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/release/') # 19 leading chars
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure repository
shell: bash
run: |
git config user.email "github-actions@hazelcast.com"
git config user.name "GitHub Actions (Build Release)"
- name: Validate the release
uses: actions/github-script@v5
with:
script: |
const scriptf = require('./.github/workflows/publish-release.js')
const script = scriptf({github, context, core})
await script.validateRelease()
- name: Finalize GitHub release and milestone
if: ${{ github.event.inputs.dryrun == 'false' }}
uses: actions/github-script@v5
with:
script: |
const scriptf = require('./.github/workflows/publish-release.js')
const script = scriptf({github, context, core})
await script.publishRelease()
await script.closeMilestone()
const script = require('./.github/workflows/publish-release.js')
console.log(script)

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "test-repo-base"]
path = test-repo-base
url = https://git.sw3.cz/kamikaze/test-repo-base.git

View File

@ -19,7 +19,7 @@ Clone the repository with: `git clone https://github.com/zpqrtbnk/test-repo.git
We have test GitHUb pages (from the `gh-pages` branch) at: http://zpqrtbnk.github.io/test-repo/
We have an image in the README (markdown)
![Image](wtf.jpg)
![Image](https://raw.github.com/zpqrtbnk/test-repo/master/wtf.jpg)
We have an image in the README (html)
<img src="./wtf.jpg" />

@ -1 +0,0 @@
Subproject commit 3de11d7640ed17f93ce38d31c9dea0fd65774077