Skip to content

Commit

Permalink
chore(ci): skip autorelease workflow on non-release PRs and release P…
Browse files Browse the repository at this point in the history
…Rs without content changes (#219)

* chore(ci): skip autorelease workflow on non-release PRs

Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com>
Source-Date: Thu Sep 24 16:57:32 2020 -0400
Source-Repo: googleapis/synthtool
Source-Sha: 95dbe1bee3c7f7e52ddb24a54c37080620e0d1a2
Source-Link: googleapis/synthtool@95dbe1b

* chore(ci): verify autorelease release PR content has changes

Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com>
Source-Date: Thu Sep 24 18:06:14 2020 -0400
Source-Repo: googleapis/synthtool
Source-Sha: da29da32b3a988457b49ae290112b74f14b713cc
Source-Link: googleapis/synthtool@da29da3
  • Loading branch information
yoshi-automation committed Sep 25, 2020
1 parent 1f028b4 commit 69c5954
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/auto-release.yaml
Expand Up @@ -4,6 +4,7 @@ name: auto-release
jobs:
approve:
runs-on: ubuntu-latest
if: contains(github.head_ref, 'release-v')
steps:
- uses: actions/github-script@v3.0.0
with:
Expand All @@ -20,6 +21,24 @@ jobs:
return;
}
// only approve PRs with pom.xml and versions.txt changes
const filesPromise = github.pulls.listFiles.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const changed_files = await github.paginate(filesPromise)
if ( changed_files.length < 1 ) {
console.log( "Not proceeding since PR is empty!" )
return;
}
if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) {
console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" )
return;
}
// trigger auto-release when
// 1) it is a SNAPSHOT release (auto-generated post regular release)
// 2) there are dependency updates only
Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-datastore.git",
"sha": "89fb0e7fb67857176b5d3ded3f0a5e2aaf76880b"
"sha": "1f028b47f36430b00ae17cbb80eee324b875e237"
}
},
{
Expand All @@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "916c10e8581804df2b48a0f0457d848f3faa582e"
"sha": "da29da32b3a988457b49ae290112b74f14b713cc"
}
}
],
Expand Down

0 comments on commit 69c5954

Please sign in to comment.