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

Skip deploy workflow when PyPI token is not defined in GitHub secrets #147

Merged
merged 15 commits into from
May 10, 2024

Conversation

Ndpnt
Copy link
Collaborator

@Ndpnt Ndpnt commented May 9, 2024

  • Technical improvement
  • Impacted areas: CI workflows
  • Details:
    • Skip deploy workflow when PyPI token is not defined in GitHub secrets
    • Rename the GitHub secret PYPI_TOKEN_OPENFISCA_BOT used in deploy workflow to PYPI_TOKEN
    • Ensure lint scripts work properly without reachable tags
    • Update deprecated syntax in GitHub Action workflow

@Ndpnt Ndpnt requested a review from MattiSG May 9, 2024 16:08
Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

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

Excellent work!
However, in my testing, git describe --always falls back to HEAD in case there are no tags, meaning that in such a case we will never lint any file. I understand this is better than failing, but I believe we can come up with a better alternative in case there are no tags, such as using the GitHub-provided PR target, or maybe git rev-list --max-parents=0 HEAD to get the root commit and thus lint all files.

Comment on lines 27 to 28
if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then
echo "status=success" >> $GITHUB_OUTPUT
Copy link
Member

Choose a reason for hiding this comment

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

If we go multiline, let's do it all the way 😉

Suggested change
if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then
echo "status=success" >> $GITHUB_OUTPUT
if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh"
then echo "status=success" >> $GITHUB_OUTPUT

- name: Check PYPI Token
id: check_token
run: |
if [[ -n "${{ secrets.PYPI_TOKEN }}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

The comment you made in the commit to explain the implementation is really good, but it would be useful to also have it as a comment in the code to save some future smartass 😉

.github/workflows/deploy.yml Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@MattiSG
Copy link
Member

MattiSG commented May 9, 2024

We will need @sandcha to create a new PyPI token too, to set the new PYPI_TOKEN variable 😅

Ndpnt and others added 5 commits May 10, 2024 10:18
Co-authored-by: Matti Schneider <matti@openfisca.org>
Co-authored-by: Matti Schneider <matti@openfisca.org>
@Ndpnt Ndpnt requested a review from MattiSG May 10, 2024 08:51
@Ndpnt Ndpnt force-pushed the update-deploy-workflow branch from 82a031d to 4253f37 Compare May 10, 2024 08:55
@Ndpnt Ndpnt force-pushed the update-deploy-workflow branch from 4253f37 to 269240f Compare May 10, 2024 08:58
Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

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

Beautiful 🤩
Let's merge without PYPI_TOKEN defined to confirm that deployment is cleanly skipped, and then define it and re-run the job to confirm that deployment is activated 🙂

@Ndpnt Ndpnt merged commit 496123a into main May 10, 2024
5 checks passed
@Ndpnt Ndpnt deleted the update-deploy-workflow branch May 10, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants