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

Updated Git actions workflow to label PR with InSpec major versions #6772

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Nik08
Copy link
Contributor

@Nik08 Nik08 commented Oct 9, 2023

Description

Updated Git actions workflow to label PR based on the base branch.
The only base branches that are allowed are: main, inspec-4 and inspec-5

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@Nik08 Nik08 requested a review from a team as a code owner October 9, 2023 05:47
@netlify
Copy link

netlify bot commented Oct 9, 2023

Deploy Preview for chef-inspec ready!

Name Link
🔨 Latest commit 81220a5
🔍 Latest deploy log https://app.netlify.com/sites/chef-inspec/deploys/6530e8aac66028000857ac8f
😎 Deploy Preview https://deploy-preview-6772--chef-inspec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

run: |
BASE_BRANCH="${{ github.event.pull_request.base.ref }}"
if [ "$BASE_BRANCH" == "main" ]; then
echo "::set-output name=base_branch_name::inspec-6"
Copy link
Contributor

Choose a reason for hiding this comment

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

This will not age well - we'll have to update this every time we have a new major version. I'm not sure how to get out of that, though. At least adding a comment would be good.

Copy link
Contributor Author

@Nik08 Nik08 Oct 12, 2023

Choose a reason for hiding this comment

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

Maybe I can read the VERSION file content, and fetch the major version from it and append "inspec-#{MAJOR VERSION}", when the base branch is main.

And for the rest, If the base branch starts with inspec- then just directly pick the base branch. This way it gets generic but it takes away our safe checks [ "$BASE_BRANCH" == "inspec-4" ] || [ "$BASE_BRANCH" == "inspec-5" ].
By this I mean, if by any chance someone creates a dummy branch with inspec- then it will create a label for that. It could be inspec-random-branch-name or inspec-100 etc..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will have to check though if reading file content is possible or not. I know matching is possible, will play around with reading content though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants