Skip to content

Commit 6d48066

Browse files
authored
fix: Correct channel deletion logic in Firebase workflow (#74)
- **Improved Logic**: - Updated the `delete-firebase-hosting-channel.yml` workflow to dynamically resolve the full channel name based on the pull request number. - Uses `grep` and `cut` to extract the channel name from the `hosting:channel:list` command. - Ensures robust and accurate deletion of the associated Firebase hosting channel. - **Enhancements**: - Added logic to safely pass the resolved channel name to the `firebase hosting:channel:delete` command using `xargs`. - Maintains backward compatibility with the existing environment variables and configurations. - **Objective**: - Automate cleanup of Firebase hosting channels linked to pull requests for better resource management.
1 parent 182f857 commit 6d48066

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/delete-firebase-hosting-channel.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
- uses: actions/checkout@v4
1212
- uses: w9jds/firebase-action@818980820c18bcd6a2e3e4739c6fe174ce5b467f # v13.27.0
1313
with:
14-
args: hosting:channel:delete ${{ github.head_ref }} --force
14+
# Extracts the full channel name from the PR number and feeds it to the delete command
15+
args: hosting:channel:list | grep 'pr${{ github.event.pull_request.number }}' | cut --delimeter ' ' --fields 2 | xargs -I {} firebase hosting:channel:delete --force {}
1516
env:
1617
GCP_SA_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_BVARGA_FE600 }}
1718
PROJECT_ID: bvarga-fe600

0 commit comments

Comments
 (0)