Another set of migrations from set-output to GITHUB_OUTPUT (#35843)
Co-authored-by: Roy Ho <roykho77@gmail.com>
This commit is contained in:
parent
6e20f66966
commit
03d52ff13b
|
@ -1,28 +1,28 @@
|
|||
name: Cherry Pick Tool
|
||||
on:
|
||||
issues:
|
||||
types: [milestoned, labeled]
|
||||
pull_request:
|
||||
types: [closed]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_branch:
|
||||
description: Provide the release branch you want to cherry pick into. Example release/6.9
|
||||
default: ''
|
||||
required: true
|
||||
pull_requests:
|
||||
description: The pull request number.
|
||||
default: ''
|
||||
required: true
|
||||
skipSlackPing:
|
||||
description: "Skip Slack Ping: If true, the Slack ping will be skipped (useful for testing)"
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
slackChannelOverride:
|
||||
description: "Slack Channel Override: The channel ID to send the Slack ping about the code freeze violation"
|
||||
required: false
|
||||
default: ''
|
||||
issues:
|
||||
types: [milestoned, labeled]
|
||||
pull_request:
|
||||
types: [closed]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_branch:
|
||||
description: Provide the release branch you want to cherry pick into. Example release/6.9
|
||||
default: ''
|
||||
required: true
|
||||
pull_requests:
|
||||
description: The pull request number.
|
||||
default: ''
|
||||
required: true
|
||||
skipSlackPing:
|
||||
description: 'Skip Slack Ping: If true, the Slack ping will be skipped (useful for testing)'
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
slackChannelOverride:
|
||||
description: 'Slack Channel Override: The channel ID to send the Slack ping about the code freeze violation'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
env:
|
||||
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
||||
|
@ -31,320 +31,321 @@ env:
|
|||
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com'
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Verify
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
run: ${{ steps.check.outputs.run }}
|
||||
steps:
|
||||
- name: check
|
||||
id: check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
let run = false;
|
||||
verify:
|
||||
name: Verify
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
run: ${{ steps.check.outputs.run }}
|
||||
steps:
|
||||
- name: check
|
||||
id: check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
let run = false;
|
||||
|
||||
const isManualTrigger = context.payload.inputs && context.payload.inputs.release_branch && context.payload.inputs.release_branch != null;
|
||||
|
||||
const isMergedMilestonedIssue = context.payload.issue && context.payload.issue.pull_request != null && context.payload.issue.pull_request.merged_at != null && context.payload.issue.milestone != null;
|
||||
|
||||
const isMergedMilestonedPR = context.payload.pull_request && context.payload.pull_request != null && context.payload.pull_request.merged == true && context.payload.pull_request.milestone != null;
|
||||
const isManualTrigger = context.payload.inputs && context.payload.inputs.release_branch && context.payload.inputs.release_branch != null;
|
||||
|
||||
const isBot = context.payload.pull_request && ( context.payload.pull_request.user.login == 'github-actions[bot]' || context.payload.pull_request.user.type == 'Bot' );
|
||||
const isMergedMilestonedIssue = context.payload.issue && context.payload.issue.pull_request != null && context.payload.issue.pull_request.merged_at != null && context.payload.issue.milestone != null;
|
||||
|
||||
if ( !isBot && ( isManualTrigger || isMergedMilestonedIssue || isMergedMilestonedPR ) ) {
|
||||
console.log( "::set-output name=run::true" );
|
||||
} else {
|
||||
console.log( "::set-output name=run::false" );
|
||||
}
|
||||
prep:
|
||||
name: Prep inputs
|
||||
runs-on: ubuntu-20.04
|
||||
needs: verify
|
||||
if: needs.verify.outputs.run == 'true'
|
||||
outputs:
|
||||
release: ${{ steps.prep-inputs.outputs.release }}
|
||||
pr: ${{ steps.prep-inputs.outputs.pr }}
|
||||
version: ${{ steps.prep-inputs.outputs.version }}
|
||||
steps:
|
||||
- name: Prep inputs
|
||||
id: prep-inputs
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const event = ${{ toJSON( github.event ) }}
|
||||
const isMergedMilestonedPR = context.payload.pull_request && context.payload.pull_request != null && context.payload.pull_request.merged == true && context.payload.pull_request.milestone != null;
|
||||
|
||||
// Means this workflow was triggered manually.
|
||||
if ( event.inputs && event.inputs.release_branch ) {
|
||||
const releaseBranch = '${{ inputs.release_branch }}'
|
||||
const version = releaseBranch.replace( 'release/', '' );
|
||||
const isBot = context.payload.pull_request && ( context.payload.pull_request.user.login == 'github-actions[bot]' || context.payload.pull_request.user.type == 'Bot' );
|
||||
|
||||
console.log( "::set-output name=version::" + version )
|
||||
console.log( "::set-output name=release::${{ inputs.release_branch }}" )
|
||||
} else if ( event.action === 'milestoned' ) {
|
||||
const version = '${{ github.event.issue.milestone.title }}'
|
||||
const release = version.substring( 0, 3 )
|
||||
if ( !isBot && ( isManualTrigger || isMergedMilestonedIssue || isMergedMilestonedPR ) ) {
|
||||
core.setOutput( 'run', 'true' );
|
||||
} else {
|
||||
core.setOutput( 'run', 'false' );
|
||||
}
|
||||
prep:
|
||||
name: Prep inputs
|
||||
runs-on: ubuntu-20.04
|
||||
needs: verify
|
||||
if: needs.verify.outputs.run == 'true'
|
||||
outputs:
|
||||
release: ${{ steps.prep-inputs.outputs.release }}
|
||||
pr: ${{ steps.prep-inputs.outputs.pr }}
|
||||
version: ${{ steps.prep-inputs.outputs.version }}
|
||||
steps:
|
||||
- name: Prep inputs
|
||||
id: prep-inputs
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const event = ${{ toJSON( github.event ) }}
|
||||
|
||||
console.log( "::set-output name=version::" + version )
|
||||
console.log( "::set-output name=release::release/" + release )
|
||||
} else {
|
||||
const version = '${{ github.event.pull_request.milestone.title }}'
|
||||
const release = version.substring( 0, 3 )
|
||||
// Means this workflow was triggered manually.
|
||||
if ( event.inputs && event.inputs.release_branch ) {
|
||||
const releaseBranch = '${{ inputs.release_branch }}'
|
||||
const version = releaseBranch.replace( 'release/', '' )
|
||||
|
||||
console.log( "::set-output name=version::" + version )
|
||||
console.log( "::set-output name=release::release/" + release )
|
||||
}
|
||||
core.setOutput( 'version', version )
|
||||
core.setOutput( 'release', releaseBranch )
|
||||
} else if ( event.action === 'milestoned' ) {
|
||||
const version = '${{ github.event.issue.milestone.title }}'
|
||||
const release = version.substring( 0, 3 )
|
||||
|
||||
// Means this workflow was triggered manually.
|
||||
if ( event.inputs && event.inputs.pull_requests ) {
|
||||
console.log( "::set-output name=pr::${{ inputs.pull_requests }}" )
|
||||
} else if ( event.action === 'milestoned' ) {
|
||||
console.log( "::set-output name=pr::${{ github.event.issue.number }}" )
|
||||
} else {
|
||||
console.log( "::set-output name=pr::${{ github.event.pull_request.number }}" )
|
||||
}
|
||||
check-release-branch-exists:
|
||||
name: Check for existence of release branch
|
||||
runs-on: ubuntu-20.04
|
||||
needs: prep
|
||||
steps:
|
||||
- name: Check for release branch
|
||||
id: release-breanch-check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
// This will throw an error for non-200 responses, which prevents subsequent jobs from completing, as desired.
|
||||
await github.request( 'GET /repos/{owner}/{repo}/branches/{branch}', {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
branch: '${{ needs.prep.outputs.release }}',
|
||||
} );
|
||||
cherry-pick-run:
|
||||
name: Run cherry pick tool
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [ prep, check-release-branch-exists ]
|
||||
if: success()
|
||||
steps:
|
||||
- name: Checkout release branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
core.setOutput( 'version', version )
|
||||
core.setOutput( 'release', `release/${release}` )
|
||||
} else {
|
||||
const version = '${{ github.event.pull_request.milestone.title }}'
|
||||
const release = version.substring( 0, 3 )
|
||||
|
||||
- name: Git fetch the release branch
|
||||
run: git fetch origin ${{ needs.prep.outputs.release }}
|
||||
|
||||
- name: Checkout release branch
|
||||
run: git checkout ${{ needs.prep.outputs.release }}
|
||||
|
||||
- name: Create a cherry pick branch based on release branch
|
||||
run: git checkout -b cherry-pick-${{ needs.prep.outputs.version }}/${{ needs.prep.outputs.pr }}
|
||||
|
||||
- name: Get commit sha from PR
|
||||
id: commit-sha
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const pr = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: '${{ needs.prep.outputs.pr }}'
|
||||
})
|
||||
|
||||
console.log( `::set-output name=sha::${ pr.data.merge_commit_sha }` )
|
||||
|
||||
- name: Cherry pick
|
||||
run: |
|
||||
git cherry-pick ${{ steps.commit-sha.outputs.sha }}
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
|
||||
const changelogsToBeDeleted = []
|
||||
let changelogTxt = '';
|
||||
|
||||
const commit = await github.rest.repos.getCommit({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref: '${{ steps.commit-sha.outputs.sha }}'
|
||||
})
|
||||
|
||||
for ( const file of commit.data.files ) {
|
||||
if ( file.filename.match( 'plugins/woocommerce/changelog/' ) ) {
|
||||
if ( changelogsToBeDeleted.indexOf( file.filename ) === -1 ) {
|
||||
changelogsToBeDeleted.push( file.filename );
|
||||
}
|
||||
|
||||
let changelogEntry = '';
|
||||
let changelogEntryType = '';
|
||||
|
||||
fs.readFile( './' + file.filename, 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
const changelogEntryArr = data.split( "\n" );
|
||||
changelogEntryType = data.match( /Type: (.+)/i );
|
||||
changelogEntryType = changelogEntryType[ 1 ].charAt( 0 ).toUpperCase() + changelogEntryType[ 1 ].slice( 1 );
|
||||
|
||||
changelogEntry = changelogEntryArr.filter( el => {
|
||||
return el !== null && typeof el !== 'undefined' && el !== '';
|
||||
} );
|
||||
changelogEntry = changelogEntry[ changelogEntry.length - 1 ];
|
||||
|
||||
// Check if changelogEntry is what we want.
|
||||
if ( changelogEntry.length < 1 ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( changelogEntry.match( /significance:/i ) ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( changelogEntry.match( /type:/i ) ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( changelogEntry.match( /comment:/i ) ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( ! changelogEntry ) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.readFile( './plugins/woocommerce/readme.txt', 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
changelogTxt = data.split( "\n" );
|
||||
let isInRange = false;
|
||||
let newChangelogTxt = [];
|
||||
|
||||
for ( const line of changelogTxt ) {
|
||||
if ( isInRange === false && line === '== Changelog ==' ) {
|
||||
isInRange = true;
|
||||
core.setOutput( 'version', version )
|
||||
core.setOutput( 'release', `release/${release}` )
|
||||
}
|
||||
|
||||
if ( isInRange === true && line.match( /\*\*WooCommerce Blocks/ ) ) {
|
||||
isInRange = false;
|
||||
// Means this workflow was triggered manually.
|
||||
if ( event.inputs && event.inputs.pull_requests ) {
|
||||
core.setOutput( 'pr', '${{ inputs.pull_requests }}' )
|
||||
} else if ( event.action === 'milestoned' ) {
|
||||
core.setOutput( 'pr', '${{ github.event.issue.number }}' )
|
||||
} else {
|
||||
core.setOutput( 'pr', '${{ github.event.pull_request.number }}' )
|
||||
}
|
||||
check-release-branch-exists:
|
||||
name: Check for existence of release branch
|
||||
runs-on: ubuntu-20.04
|
||||
needs: prep
|
||||
steps:
|
||||
- name: Check for release branch
|
||||
id: release-breanch-check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
// This will throw an error for non-200 responses, which prevents subsequent jobs from completing, as desired.
|
||||
await github.request( 'GET /repos/{owner}/{repo}/branches/{branch}', {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
branch: '${{ needs.prep.outputs.release }}',
|
||||
} );
|
||||
cherry-pick-run:
|
||||
name: Run cherry pick tool
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [prep, check-release-branch-exists]
|
||||
if: success()
|
||||
steps:
|
||||
- name: Checkout release branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Git fetch the release branch
|
||||
run: git fetch origin ${{ needs.prep.outputs.release }}
|
||||
|
||||
- name: Checkout release branch
|
||||
run: git checkout ${{ needs.prep.outputs.release }}
|
||||
|
||||
- name: Create a cherry pick branch based on release branch
|
||||
run: git checkout -b cherry-pick-${{ needs.prep.outputs.version }}/${{ needs.prep.outputs.pr }}
|
||||
|
||||
- name: Get commit sha from PR
|
||||
id: commit-sha
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const pr = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: '${{ needs.prep.outputs.pr }}'
|
||||
})
|
||||
|
||||
core.setOutput( 'sha', pr.data.merge_commit_sha )
|
||||
|
||||
- name: Cherry pick
|
||||
run: |
|
||||
git cherry-pick ${{ steps.commit-sha.outputs.sha }}
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
|
||||
const changelogsToBeDeleted = []
|
||||
let changelogTxt = '';
|
||||
|
||||
const commit = await github.rest.repos.getCommit({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref: '${{ steps.commit-sha.outputs.sha }}'
|
||||
})
|
||||
|
||||
for ( const file of commit.data.files ) {
|
||||
if ( file.filename.match( 'plugins/woocommerce/changelog/' ) ) {
|
||||
if ( changelogsToBeDeleted.indexOf( file.filename ) === -1 ) {
|
||||
changelogsToBeDeleted.push( file.filename );
|
||||
}
|
||||
|
||||
let changelogEntry = '';
|
||||
let changelogEntryType = '';
|
||||
|
||||
fs.readFile( './' + file.filename, 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
const changelogEntryArr = data.split( "\n" );
|
||||
changelogEntryType = data.match( /Type: (.+)/i );
|
||||
changelogEntryType = changelogEntryType[ 1 ].charAt( 0 ).toUpperCase() + changelogEntryType[ 1 ].slice( 1 );
|
||||
|
||||
changelogEntry = changelogEntryArr.filter( el => {
|
||||
return el !== null && typeof el !== 'undefined' && el !== '';
|
||||
} );
|
||||
changelogEntry = changelogEntry[ changelogEntry.length - 1 ];
|
||||
|
||||
// Check if changelogEntry is what we want.
|
||||
if ( changelogEntry.length < 1 ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( changelogEntry.match( /significance:/i ) ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( changelogEntry.match( /type:/i ) ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( changelogEntry.match( /comment:/i ) ) {
|
||||
changelogEntry = false;
|
||||
}
|
||||
|
||||
if ( ! changelogEntry ) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.readFile( './plugins/woocommerce/readme.txt', 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
changelogTxt = data.split( "\n" );
|
||||
let isInRange = false;
|
||||
let newChangelogTxt = [];
|
||||
|
||||
for ( const line of changelogTxt ) {
|
||||
if ( isInRange === false && line === '== Changelog ==' ) {
|
||||
isInRange = true;
|
||||
}
|
||||
|
||||
if ( isInRange === true && line.match( /\*\*WooCommerce Blocks/ ) ) {
|
||||
isInRange = false;
|
||||
}
|
||||
|
||||
// Find the first match of the entry "Type".
|
||||
if ( isInRange && line.match( `\\* ${changelogEntryType} -` ) ) {
|
||||
newChangelogTxt.push( '* ' + changelogEntryType + ' - ' + changelogEntry + ` [#${{ needs.prep.outputs.pr }}](https://github.com/woocommerce/woocommerce/pull/${{ needs.prep.outputs.pr }})` );
|
||||
newChangelogTxt.push( line );
|
||||
isInRange = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
newChangelogTxt.push( line );
|
||||
}
|
||||
|
||||
fs.writeFile( './plugins/woocommerce/readme.txt', newChangelogTxt.join( "\n" ), err => {
|
||||
if ( err ) {
|
||||
console.error( `Unable to generate the changelog entry for PR ${{ needs.prep.outputs.pr }}` );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
// Find the first match of the entry "Type".
|
||||
if ( isInRange && line.match( `\\* ${changelogEntryType} -` ) ) {
|
||||
newChangelogTxt.push( '* ' + changelogEntryType + ' - ' + changelogEntry + ` [#${{ needs.prep.outputs.pr }}](https://github.com/woocommerce/woocommerce/pull/${{ needs.prep.outputs.pr }})` );
|
||||
newChangelogTxt.push( line );
|
||||
isInRange = false;
|
||||
continue;
|
||||
}
|
||||
core.setOutput( 'changelogsToBeDeleted', changelogsToBeDeleted.join( ' ' ) )
|
||||
|
||||
newChangelogTxt.push( line );
|
||||
}
|
||||
- name: Delete changelog files from cherry pick branch
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git rm ${{ steps.changelog.outputs.changelogsToBeDeleted }}
|
||||
|
||||
fs.writeFile( './plugins/woocommerce/readme.txt', newChangelogTxt.join( "\n" ), err => {
|
||||
if ( err ) {
|
||||
console.error( `Unable to generate the changelog entry for PR ${{ needs.prep.outputs.pr }}` );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
}
|
||||
- name: Commit changes for cherry pick
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git commit --no-verify -am "Prep for cherry pick ${{ needs.prep.outputs.pr }}"
|
||||
|
||||
console.log( `::set-output name=changelogsToBeDeleted::${ changelogsToBeDeleted }` )
|
||||
- name: Push cherry pick branch up
|
||||
run: git push origin cherry-pick-${{ needs.prep.outputs.version }}/${{ needs.prep.outputs.pr }}
|
||||
|
||||
- name: Delete changelog files from cherry pick branch
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git rm ${{ steps.changelog.outputs.changelogsToBeDeleted }}
|
||||
- name: Create the PR for cherry pick branch
|
||||
id: cherry-pick-pr
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
let cherryPickPRBody = "This PR cherry-picks the following PRs into the release branch:\n";
|
||||
|
||||
- name: Commit changes for cherry pick
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git commit --no-verify -am "Prep for cherry pick ${{ needs.prep.outputs.pr }}"
|
||||
cherryPickPRBody = `${cherryPickPRBody}` + `* #${{ needs.prep.outputs.pr }}` + "\n";
|
||||
|
||||
- name: Push cherry pick branch up
|
||||
run: git push origin cherry-pick-${{ needs.prep.outputs.version }}/${{ needs.prep.outputs.pr }}
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Cherry pick ${{ needs.prep.outputs.pr }} into ${{ needs.prep.outputs.release }}",
|
||||
head: "cherry-pick-${{ needs.prep.outputs.version }}/${{ needs.prep.outputs.pr }}",
|
||||
base: "${{ needs.prep.outputs.release }}",
|
||||
body: cherryPickPRBody
|
||||
})
|
||||
|
||||
- name: Create the PR for cherry pick branch
|
||||
id: cherry-pick-pr
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
let cherryPickPRBody = "This PR cherry-picks the following PRs into the release branch:\n";
|
||||
core.setOutput( 'cherry-pick-pr', pr.data.html_url )
|
||||
|
||||
cherryPickPRBody = `${cherryPickPRBody}` + `* #${{ needs.prep.outputs.pr }}` + "\n";
|
||||
- name: Checkout trunk branch
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git checkout trunk
|
||||
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Cherry pick ${{ needs.prep.outputs.pr }} into ${{ needs.prep.outputs.release }}",
|
||||
head: "cherry-pick-${{ needs.prep.outputs.version }}/${{ needs.prep.outputs.pr }}",
|
||||
base: "${{ needs.prep.outputs.release }}",
|
||||
body: cherryPickPRBody
|
||||
})
|
||||
- name: Create a branch based on trunk branch
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git checkout -b delete-changelogs/${{ needs.prep.outputs.pr }}
|
||||
|
||||
console.log( `::set-output name=cherry-pick-pr::${ pr.data.html_url }` )
|
||||
- name: Checkout trunk branch
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git checkout trunk
|
||||
- name: Delete changelogs from trunk
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git rm ${{ steps.changelog.outputs.changelogsToBeDeleted }}
|
||||
|
||||
- name: Create a branch based on trunk branch
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git checkout -b delete-changelogs/${{ needs.prep.outputs.pr }}
|
||||
- name: Commit changes for deletion
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git commit --no-verify -am "Delete changelog files for ${{ needs.prep.outputs.pr }}"
|
||||
|
||||
- name: Delete changelogs from trunk
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git rm ${{ steps.changelog.outputs.changelogsToBeDeleted }}
|
||||
- name: Push deletion branch up
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git push origin delete-changelogs/${{ needs.prep.outputs.pr }}
|
||||
|
||||
- name: Commit changes for deletion
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git commit --no-verify -am "Delete changelog files for ${{ needs.prep.outputs.pr }}"
|
||||
- name: Create the PR for deletion branch
|
||||
id: deletion-pr
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Delete changelog files based on PR ${{ needs.prep.outputs.pr }}",
|
||||
head: "delete-changelogs/${{ needs.prep.outputs.pr }}",
|
||||
base: "trunk",
|
||||
body: "Delete changelog files based on PR #${{ needs.prep.outputs.pr }}"
|
||||
})
|
||||
|
||||
- name: Push deletion branch up
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
run: git push origin delete-changelogs/${{ needs.prep.outputs.pr }}
|
||||
core.setOutput( 'deletion-pr', pr.data.html_url )
|
||||
|
||||
- name: Create the PR for deletion branch
|
||||
id: deletion-pr
|
||||
if: steps.changelog.outputs.changelogsToBeDeleted != '' && steps.changelog.outputs.changelogsToBeDeleted != null
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Delete changelog files based on PR ${{ needs.prep.outputs.pr }}",
|
||||
head: "delete-changelogs/${{ needs.prep.outputs.pr }}",
|
||||
base: "trunk",
|
||||
body: "Delete changelog files based on PR #${{ needs.prep.outputs.pr }}"
|
||||
})
|
||||
- name: Notify Slack on failure
|
||||
if: ${{ failure() && inputs.skipSlackPing != true }}
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: Code freeze violation. PR(s) created that breaks the Code Freeze for '${{ needs.prep.outputs.release }}' :ice_cube:
|
||||
|
||||
console.log( `::set-output name=deletion-pr::${ pr.data.html_url }` )
|
||||
An attempt to cherry pick PR(s) into outgoing release '${{ needs.prep.outputs.release }}' has failed. This could be due to a merge conflict or something else that requires manual attention. Please check: https://github.com/woocommerce/woocommerce/pull/${{ needs.prep.outputs.pr }}
|
||||
|
||||
- name: Notify Slack on failure
|
||||
if: ${{ failure() && inputs.skipSlackPing != true }}
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: Code freeze violation. PR(s) created that breaks the Code Freeze for '${{ needs.prep.outputs.release }}' :ice_cube:
|
||||
- name: Notify Slack on success
|
||||
if: ${{ success() && inputs.skipSlackPing != true }}
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: Code freeze violation. PR(s) created that breaks the Code Freeze for '${{ needs.prep.outputs.release }}' :ice_cube:
|
||||
|
||||
An attempt to cherry pick PR(s) into outgoing release '${{ needs.prep.outputs.release }}' has failed. This could be due to a merge conflict or something else that requires manual attention. Please check: https://github.com/woocommerce/woocommerce/pull/${{ needs.prep.outputs.pr }}
|
||||
Release lead please review:
|
||||
|
||||
- name: Notify Slack on success
|
||||
if: ${{ success() && inputs.skipSlackPing != true }}
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: Code freeze violation. PR(s) created that breaks the Code Freeze for '${{ needs.prep.outputs.release }}' :ice_cube:
|
||||
|
||||
Release lead please review:
|
||||
|
||||
${{ steps.cherry-pick-pr.outputs.cherry-pick-pr }}
|
||||
${{ steps.deletion-pr.outputs.deletion-pr }}
|
||||
${{ steps.cherry-pick-pr.outputs.cherry-pick-pr }}
|
||||
${{ steps.deletion-pr.outputs.deletion-pr }}
|
||||
|
|
|
@ -1,38 +1,40 @@
|
|||
name: Add Community Label
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Verify
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
verify:
|
||||
name: Verify
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
|
||||
|
||||
- name: Install Octokit
|
||||
run: npm --prefix .github/workflows/scripts install @octokit/action
|
||||
- name: Install Octokit
|
||||
run: npm --prefix .github/workflows/scripts install @octokit/action
|
||||
|
||||
- name: Check if user is a community contributor
|
||||
id: check
|
||||
run: node .github/workflows/scripts/is-community-contributor.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "If community PR, assign a reviewer"
|
||||
if: github.event.pull_request && steps.check.outputs.is-community == 'yes'
|
||||
uses: shufo/auto-assign-reviewer-by-files@f5f3db9ef06bd72ab6978996988c6462cbdaabf6
|
||||
with:
|
||||
config: ".github/project-community-pr-assigner.yml"
|
||||
token: ${{ secrets.PR_ASSIGN_TOKEN }}
|
||||
- name: Install Actions Core
|
||||
run: npm --prefix .github/workflows/scripts install @actions/core
|
||||
|
||||
- name: Check if user is a community contributor
|
||||
id: check
|
||||
run: node .github/workflows/scripts/is-community-contributor.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 'If community PR, assign a reviewer'
|
||||
if: github.event.pull_request && steps.check.outputs.is-community == 'yes'
|
||||
uses: shufo/auto-assign-reviewer-by-files@f5f3db9ef06bd72ab6978996988c6462cbdaabf6
|
||||
with:
|
||||
config: '.github/project-community-pr-assigner.yml'
|
||||
token: ${{ secrets.PR_ASSIGN_TOKEN }}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: Run post release processes
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
env:
|
||||
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
||||
|
@ -10,119 +10,119 @@ env:
|
|||
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com'
|
||||
|
||||
jobs:
|
||||
changelog-version-update:
|
||||
name: Update changelog and version
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
changelog-version-update:
|
||||
name: Update changelog and version
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Git fetch trunk branch
|
||||
run: git fetch origin trunk
|
||||
- name: Git fetch trunk branch
|
||||
run: git fetch origin trunk
|
||||
|
||||
- name: Copy readme.txt to vm root
|
||||
run: cp ./plugins/woocommerce/readme.txt ../../readme.txt
|
||||
- name: Copy readme.txt to vm root
|
||||
run: cp ./plugins/woocommerce/readme.txt ../../readme.txt
|
||||
|
||||
- name: Switch to trunk branch
|
||||
run: git checkout trunk
|
||||
- name: Switch to trunk branch
|
||||
run: git checkout trunk
|
||||
|
||||
- name: Create a new branch based on trunk
|
||||
run: git checkout -b prep/post-release-tasks-${{ github.event.release.tag_name }}
|
||||
- name: Create a new branch based on trunk
|
||||
run: git checkout -b prep/post-release-tasks-${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Check if we need to continue processing
|
||||
uses: actions/github-script@v6
|
||||
id: check
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
const version = ${{ toJSON( github.event.release.tag_name ) }}
|
||||
- name: Check if we need to continue processing
|
||||
uses: actions/github-script@v6
|
||||
id: check
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
const version = ${{ toJSON( github.event.release.tag_name ) }}
|
||||
|
||||
fs.readFile( './plugins/woocommerce/readme.txt', 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
fs.readFile( './plugins/woocommerce/readme.txt', 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
const regex = /Stable\stag:\s(\d+\.\d+\.\d+)/;
|
||||
const regex = /Stable\stag:\s(\d+\.\d+\.\d+)/;
|
||||
|
||||
const stableVersion = data.match( regex )[1];
|
||||
const stableVersion = data.match( regex )[1];
|
||||
|
||||
// If the release version is less than stable version we can bail.
|
||||
if ( version.localeCompare( stableVersion, undefined, { numeric: true, sensitivity: 'base' } ) == -1 ) {
|
||||
console.log( 'Release version is less than stable version. No automated action taken. A manual process is required.' );
|
||||
console.log( `::set-output name=continue::false` )
|
||||
return;
|
||||
} else {
|
||||
console.log( `::set-output name=continue::true` )
|
||||
}
|
||||
} )
|
||||
// If the release version is less than stable version we can bail.
|
||||
if ( version.localeCompare( stableVersion, undefined, { numeric: true, sensitivity: 'base' } ) == -1 ) {
|
||||
console.log( 'Release version is less than stable version. No automated action taken. A manual process is required.' );
|
||||
core.setOutput( 'continue', 'false' )
|
||||
return;
|
||||
} else {
|
||||
core.setOutput( 'continue', 'true' )
|
||||
}
|
||||
} )
|
||||
|
||||
- name: Update changelog.txt entries
|
||||
uses: actions/github-script@v6
|
||||
id: update-entries
|
||||
if: steps.check.outputs.continue == 'true'
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
const version = ${{ toJSON( github.event.release.tag_name ) }}
|
||||
- name: Update changelog.txt entries
|
||||
uses: actions/github-script@v6
|
||||
id: update-entries
|
||||
if: steps.check.outputs.continue == 'true'
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
const version = ${{ toJSON( github.event.release.tag_name ) }}
|
||||
|
||||
// Read the saved readme.txt file from earlier.
|
||||
fs.readFile( '../../readme.txt', 'utf-8', function( err, readme ) {
|
||||
if ( err ) {
|
||||
console.log( `::set-output name=continue::false` )
|
||||
console.error( err );
|
||||
}
|
||||
// Read the saved readme.txt file from earlier.
|
||||
fs.readFile( '../../readme.txt', 'utf-8', function( err, readme ) {
|
||||
if ( err ) {
|
||||
core.setOutput( 'continue', 'false' );
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
const regex = /(== Changelog ==[\s\S]+)\s{2}\[See changelog for all versions\]\(https:\/\/raw\.githubusercontent\.com\/woocommerce\/woocommerce\/trunk\/changelog\.txt\)\./;
|
||||
const regex = /(== Changelog ==[\s\S]+)\s{2}\[See changelog for all versions\]\(https:\/\/raw\.githubusercontent\.com\/woocommerce\/woocommerce\/trunk\/changelog\.txt\)\./;
|
||||
|
||||
const entries = readme.match( regex )[1];
|
||||
const entries = readme.match( regex )[1];
|
||||
|
||||
fs.readFile( './changelog.txt', 'utf-8', function( err, changelog ) {
|
||||
if ( err ) {
|
||||
console.log( `::set-output name=continue::false` )
|
||||
console.error( err );
|
||||
}
|
||||
fs.readFile( './changelog.txt', 'utf-8', function( err, changelog ) {
|
||||
if ( err ) {
|
||||
core.setOutput( 'continue', 'false' );
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
const regex = /== Changelog ==/;
|
||||
const regex = /== Changelog ==/;
|
||||
|
||||
const updatedChangelog = changelog.replace( regex, entries );
|
||||
const updatedChangelog = changelog.replace( regex, entries );
|
||||
|
||||
fs.writeFile( './changelog.txt', updatedChangelog, err => {
|
||||
if ( err ) {
|
||||
console.log( `::set-output name=continue::false` )
|
||||
console.error( 'Unable to update changelog entries in changelog.txt' );
|
||||
}
|
||||
fs.writeFile( './changelog.txt', updatedChangelog, err => {
|
||||
if ( err ) {
|
||||
core.setOutput( 'continue', 'false' );
|
||||
console.error( 'Unable to update changelog entries in changelog.txt' );
|
||||
}
|
||||
|
||||
console.log( `::set-output name=continue::true` )
|
||||
} )
|
||||
} )
|
||||
} )
|
||||
core.setOutput( 'continue', 'true' );
|
||||
} )
|
||||
} )
|
||||
} )
|
||||
|
||||
- name: Commit changes
|
||||
if: steps.update-entries.outputs.continue == 'true'
|
||||
run: git commit -am "Prep trunk post release ${{ github.event.release.tag_name }}"
|
||||
- name: Commit changes
|
||||
if: steps.update-entries.outputs.continue == 'true'
|
||||
run: git commit -am "Prep trunk post release ${{ github.event.release.tag_name }}"
|
||||
|
||||
- name: Push branch up
|
||||
if: steps.update-entries.outputs.continue == 'true'
|
||||
run: git push origin prep/post-release-tasks-${{ github.event.release.tag_name }}
|
||||
- name: Push branch up
|
||||
if: steps.update-entries.outputs.continue == 'true'
|
||||
run: git push origin prep/post-release-tasks-${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Create the PR
|
||||
if: steps.update-entries.outputs.continue == 'true'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const body = "This PR updates the changelog.txt entries based on the latest release: ${{ github.event.release.tag_name }}"
|
||||
- name: Create the PR
|
||||
if: steps.update-entries.outputs.continue == 'true'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const body = "This PR updates the changelog.txt entries based on the latest release: ${{ github.event.release.tag_name }}"
|
||||
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Update changelog.txt from release ${{ github.event.release.tag_name }}",
|
||||
head: "prep/post-release-tasks-${{ github.event.release.tag_name }}",
|
||||
base: "trunk",
|
||||
body: body
|
||||
})
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Update changelog.txt from release ${{ github.event.release.tag_name }}",
|
||||
head: "prep/post-release-tasks-${{ github.event.release.tag_name }}",
|
||||
base: "trunk",
|
||||
body: body
|
||||
})
|
||||
|
||||
const prCreated = await github.rest.pulls.requestReviewers({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: pr.data.number,
|
||||
reviewers: ["${{ github.event.release.author.login }}"]
|
||||
})
|
||||
const prCreated = await github.rest.pulls.requestReviewers({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: pr.data.number,
|
||||
reviewers: ["${{ github.event.release.author.login }}"]
|
||||
})
|
||||
|
|
|
@ -1,50 +1,62 @@
|
|||
// Note you'll need to install this dependency as part of your workflow.
|
||||
const { Octokit } = require('@octokit/action');
|
||||
// Note you'll need to install these dependencies as part of your workflow.
|
||||
const { Octokit } = require( '@octokit/action' );
|
||||
const core = require( '@actions/core' );
|
||||
|
||||
// Note that this script assumes you set GITHUB_TOKEN in env, if you don't
|
||||
// this won't work.
|
||||
const octokit = new Octokit();
|
||||
|
||||
const getIssueAuthor = (payload) => {
|
||||
return payload?.issue?.user?.login || payload?.pull_request?.user?.login || null;
|
||||
}
|
||||
const getIssueAuthor = ( payload ) => {
|
||||
return (
|
||||
payload?.issue?.user?.login ||
|
||||
payload?.pull_request?.user?.login ||
|
||||
null
|
||||
);
|
||||
};
|
||||
|
||||
const isCommunityContributor = async (owner, repo, username) => {
|
||||
if (username) {
|
||||
const {data: {permission}} = await octokit.rest.repos.getCollaboratorPermissionLevel({
|
||||
const isCommunityContributor = async ( owner, repo, username ) => {
|
||||
if ( username ) {
|
||||
const {
|
||||
data: { permission },
|
||||
} = await octokit.rest.repos.getCollaboratorPermissionLevel( {
|
||||
owner,
|
||||
repo,
|
||||
username,
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
return permission === 'read' || permission === 'none';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const addLabel = async(label, owner, repo, issueNumber) => {
|
||||
await octokit.rest.issues.addLabels({
|
||||
const addLabel = async ( label, owner, repo, issueNumber ) => {
|
||||
await octokit.rest.issues.addLabels( {
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
labels: [label],
|
||||
});
|
||||
}
|
||||
labels: [ label ],
|
||||
} );
|
||||
};
|
||||
|
||||
const applyLabelToCommunityContributor = async () => {
|
||||
const eventPayload = require(process.env.GITHUB_EVENT_PATH);
|
||||
const username = getIssueAuthor(eventPayload);
|
||||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
|
||||
const eventPayload = require( process.env.GITHUB_EVENT_PATH );
|
||||
const username = getIssueAuthor( eventPayload );
|
||||
const [ owner, repo ] = process.env.GITHUB_REPOSITORY.split( '/' );
|
||||
const { number } = eventPayload?.issue || eventPayload?.pull_request;
|
||||
|
||||
const isCommunityUser = await isCommunityContributor(owner, repo, username);
|
||||
console.log( '::set-output name=is-community::%s', isCommunityUser ? 'yes' : 'no' );
|
||||
|
||||
if (isCommunityUser) {
|
||||
console.log('Adding community contributor label');
|
||||
await addLabel('type: community contribution', owner, repo, number);
|
||||
|
||||
const isCommunityUser = await isCommunityContributor(
|
||||
owner,
|
||||
repo,
|
||||
username
|
||||
);
|
||||
|
||||
core.setOutput( 'is-community', isCommunityUser ? 'yes' : 'no' );
|
||||
|
||||
if ( isCommunityUser ) {
|
||||
console.log( 'Adding community contributor label' );
|
||||
await addLabel( 'type: community contribution', owner, repo, number );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
applyLabelToCommunityContributor();
|
||||
|
|
Loading…
Reference in New Issue