Dependabot fixes (DEV-1153) #610
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π§Ή EAS Update Branch Cleanup | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read # Required to find the last successful workflow run | |
contents: read # Required for actions/checkout | |
steps: | |
- name: π Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Checks out all branches and tags. Maybe we can make this better in the future? | |
# This line is needed for nx affected to work when CI is running on a PR | |
- name: π Track main if PR | |
if: github.ref != 'refs/heads/main' | |
run: git branch --track main origin/main | |
- name: π§ Configure NX SHAs | |
uses: nrwl/nx-set-shas@v4 | |
- name: π§ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.12.2 | |
- run: | | |
corepack enable | |
- name: Setup Yarn in Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- name: π¦ Install dependencies | |
run: yarn install | |
- name: 𧩠Determine Affected Projects for eas-update | |
id: set-matrix | |
run: | | |
# Get the list of affected projects with eas-update target | |
affected_projects=$(yarn nx show projects --affected --exclude=shelter --withTarget eas-update) | |
# Convert the list to a JSON matrix | |
MATRIX_JSON=$(echo "$affected_projects" | jq -Rcs ' | |
split("\n") | | |
map(select(. != "")) | | |
if length == 0 then | |
{} | |
else | |
{include: map({project: .})} | |
end' | |
) | |
IS_MATRIX_EMPTY=$(echo "$MATRIX_JSON" | jq 'if .include | length == 0 then true else false end') | |
echo "is_matrix_empty=$IS_MATRIX_EMPTY" >> $GITHUB_OUTPUT | |
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
is_matrix_empty: ${{ steps.set-matrix.outputs.is_matrix_empty }} | |
delete-eas-branch: | |
needs: prepare | |
runs-on: ubuntu-latest | |
if: needs.prepare.outputs.is_matrix_empty == 'false' | |
steps: | |
- name: π Check out repo | |
uses: actions/checkout@v4 | |
- name: π§ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.12.2 | |
- run: | | |
corepack enable | |
- name: Setup Yarn in Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- name: π§ Setup EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: π¦ Install dependencies | |
run: yarn install | |
- name: ποΈ Delete EAS Branch & Channel for Each Project | |
run: | | |
BRANCH_NAME=${{ github.head_ref || github.ref_name }} | |
MATRIX_JSON='${{ needs.prepare.outputs.matrix }}' | |
for project in $(echo $MATRIX_JSON | jq -r '.include[].project'); do | |
echo "Deleting EAS branch for project: $project" | |
# Change to the project directory | |
cd apps/$project | |
# Run the EAS command in the project directory | |
eas branch:delete --non-interactive $BRANCH_NAME | |
# Change back to the original directory | |
cd - | |
done |