Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new steps to labelPR job to remove MnR label if version.env has been manually edited #28

Merged
merged 8 commits into from
Jan 29, 2025
44 changes: 39 additions & 5 deletions .github/workflows/bump-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,51 @@ on:
jobs:
#label PR as being compatible with the `update-versions` command
labelPR:
name: Label PR for update-versions
name: Set merge-and-release-extension-compatible label
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the name since I think the new name would be more intuitive for a random engineer. Not deeply attached to this change.

runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }}
if: |
github.event_name == 'pull_request'
&& (
github.event.action == 'opened'
|| github.event.action == 'synchronize'
)
steps:
- name: Add Label
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if version.env already has changes
id: changed-version-env
if: github.event_name != 'release'
uses: tj-actions/changed-files@467e54813892b0cf302b0bba54d233c861b97f1a
with:
files: 'version.env'

- name: Add label
# Run only if label does not yet exist and version.env has not been changed
if: |
steps.changed-version-env.outputs.any_changed == 'false'
&& !contains( github.event.pull_request.labels.*.name, 'merge-and-release-extension-compatible')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: merge-and-release-extension-compatible

- name: Remove label
# Run only if label already exists and version.env has been changed
if: |
steps.changed-version-env.outputs.any_changed == 'true'
&& contains( github.event.pull_request.labels.*.name, 'merge-and-release-extension-compatible')
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: merge-and-release-extension-compatible

- name: Output debug logs
run: |
echo "version_env_changed=${{ steps.changed-version-env.outputs.any_changed }}"
echo "labels=${{ toJSON(github.event.pull_request.labels.*.name) }}"
echo "labels_contain_mnr=${{ contains( github.event.pull_request.labels.*.name, 'merge-and-release-extension-compatible') }}"

# Increment the APP and CHART versions based on commit message starting with update-versions
parseVersionChangeRequest:
name: Parse version changes
Expand Down Expand Up @@ -90,9 +126,7 @@ jobs:
env:
EVENTNAME: ${{ github.event_name }}
changeVersions:
# !! The Merge and Release extension looks for the name "Update versions"
name: Update versions
# !! The Merge and Release extension looks for the name "Update versions"
runs-on: ubuntu-latest
needs: parseVersionChangeRequest
if: |
Expand Down