@@ -20,47 +20,46 @@ jobs:
2020 with :
2121 fetch-depth : 0
2222
23+ - name : Setup GitHub CLI
24+ run : |
25+ gh auth setup-git
26+ gh auth status
27+ env :
28+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
29+
2330 - name : Check for Blocking Issues/PRs
2431 id : check_blocks
25- uses : actions/github-script@v6
26- with :
27- script : |
28- // Check for issues with blocks-release label
29- const { data: issues } = await github.rest.issues.listForRepo({
30- owner: context.repo.owner,
31- repo: context.repo.repo,
32- labels: 'blocks-release',
33- state: 'open'
34- });
32+ run : |
33+ echo "Checking for blocking issues and PRs..."
3534
36- // Check for PRs with blocks-release label
37- const { data: prs } = await github.rest.pulls.list({
38- owner: context.repo.owner,
39- repo: context.repo.repo,
40- state: 'open'
41- });
35+ # Check for blocking issues
36+ blocking_issues=$(gh issue list -l blocks-release --json number,title --jq '.[] | "- \(.title) (#\(.number))"')
4237
43- const blockingPRs = prs.filter(pr =>
44- pr.labels.some(label => label.name === 'blocks-release')
45- );
38+ # Check for blocking PRs
39+ blocking_prs=$(gh pr list -l blocks-release --json number,title --jq '.[] | "- \(.title) (#\(.number)) (PR)"')
4640
47- const blockingItems = [
48- ...issues.map(issue => `- ${issue.title} (#${issue.number})`),
49- ...blockingPRs.map(pr => `- ${pr.title} (#${pr.number}) (PR)`)
50- ];
41+ # Combine the results
42+ blocking_items="$blocking_issues"$'\n'"$blocking_prs"
5143
52- if (blockingItems.length > 0) {
53- core.setOutput('block_release', 'true');
54- core.setOutput('blocking_items', blockingItems.join("\n"));
55- } else {
56- core.setOutput('block_release', 'false');
57- }
44+ # Remove empty lines
45+ blocking_items=$(echo "$blocking_items" | grep . || true)
46+
47+ if [ -n "$blocking_items" ]; then
48+ echo "block_release=true" >> $GITHUB_OUTPUT
49+ echo "blocking_items<<EOF" >> $GITHUB_OUTPUT
50+ echo "$blocking_items" >> $GITHUB_OUTPUT
51+ echo "EOF" >> $GITHUB_OUTPUT
52+ else
53+ echo "block_release=false" >> $GITHUB_OUTPUT
54+ fi
55+ env :
56+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5857
5958 - name : Stop if Blocks Exist
60- if : steps.check-blocks .outputs.block_release == 'true'
59+ if : steps.check_blocks .outputs.block_release == 'true'
6160 run : |
6261 echo "Blocking issues/PRs detected:"
63- echo "${{ steps.check-blocks .outputs.blocking_items }}"
62+ echo "${{ steps.check_blocks .outputs.blocking_items }}"
6463 exit 1
6564
6665 # - name: Check for changes since last release
@@ -86,11 +85,11 @@ jobs:
8685 echo "New tag: $new_tag"
8786 echo "new_tag=$new_tag" >> $GITHUB_ENV
8887
89- - name : Push New Tag
90- run : |
91- git config user.name "github-actions[bot]"
92- git config user.email "github-actions[bot]@users.noreply.github.com"
93- git tag example-${{ env.new_tag }}
94- git push origin ${{ env.new_tag }}
95- env :
96- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88+ # - name: Push New Tag
89+ # run: |
90+ # git config user.name "github-actions[bot]"
91+ # git config user.email "github-actions[bot]@users.noreply.github.com"
92+ # git tag example-${{ env.new_tag }}
93+ # git push origin example- ${{ env.new_tag }}
94+ # env:
95+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
0 commit comments