Github workflows: repsoitory not found in action/checkout section - github-actions

I'm trying to get my python project to update on Pypi automatically through a github workflow.
I've never done a github workflow (or any workflow). It doesn't seem to work.
It's this line: uses: action/checkout#main under the build-n-publish part.
It always fails and I get: Unable to resolve action action/checkout#main, repository not found.
and this happens no matter what I put in place of main whether it's v1, v2, master, etc...
I couldn't find anything online explaining it. What should I have in place of main?
for context the .yml file:
name: CI
on:
push:
branches:
- main
jobs:
build-n-publish:
name: build and publish pee to pypi
runs-on: macOS-latest
steps:
- uses: action/checkout#pee
with:
repository: ''
- name: Set up Python 3.6
uses: actions/setup-python#v1
with:
python-version: 3.6
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish#master
with:
password: ${{ secrets.pypi_password }}
repository_url: https://pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish#master
with:
password: ${{ secrets.pypi_password }}.

Related

Pulling a git submodule with private access from a Github action

I'm trying to pull a git submodule during my 'push' github action. The submodule is a private repository.
I've created a PAT with read-only access to my repositories. And I've added the contents of that PAT as a secret in the git repo (not the submodule).
This is my github action file:
name: Java CI
on: [ push ]
env:
SUBMODULE_ACCESS: ${{ secrets.SUBMODULE_ACCESS }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: Update submodules
run: |
git config --global url."https://${SUBMODULE_ACCESS}:x-oauth-basic#github.com/".insteadOf "https://github.com/"
git submodule update --init --recursive
- name: Set up JDK 19
uses: actions/setup-java#v2
with:
java-version: '19'
distribution: 'adopt'
- name: Cache local .m2
uses: actions/cache#v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**.pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run lints and test with Maven
run: mvn clean install -Dall
When I run this, I see the following error:
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
But that link just mentions PATs, which I think I've set up?

actions/upload-pages-artifact fails at actions/upload-artifact with "No files were found with the provided path"

I would like to create a GitHub Workflow that builds a C++ application using emscripten and cmake, and deploys it to GitHub Pages. My Workflow job looks like this.
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
container:
image: emscripten/emsdk
steps:
- uses: actions/checkout#v3
- run: cmake -B $GITHUB_WORKSPACE/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEMSCRIPTEN=ON
- run: cmake --build $GITHUB_WORKSPACE/build --config ${{env.BUILD_TYPE}}
# actions/upload-pages-artifact uses this directory, but it doesn't exist in the image
- run: mkdir -p ${{runner.temp}}
- uses: actions/configure-pages#v1
- uses: actions/upload-pages-artifact#v1
with:
path: $GITHUB_WORKSPACE/build
- id: deployment
uses: actions/deploy-pages#v1
upload-pages-artifact runs tar and lists all the files to be deployed in the log. When running upload-artifact the log reads Warning: No files were found with the provided path: /__w/_temp/artifact.tar. No artifacts will be uploaded..
Note that the path in the warning is different from the one provided as a parameter to upload-artifact (path: /home/runner/work/_temp/artifact.tar).
upload-pages-artifact works as expected when running without the emscripten container.
I would have to either get upload-pages-artifact working inside the container, or somehow share the build with a second job running outside the container.
Split up the job into two jobs, one for building and one for deploying. Use actions/upload-artifact and actions/download-artifact to pass the build from one job to the next. Don't use $GITHUB_WORKSPACE, as it might not point to the right directory in your image.
jobs:
build:
runs-on: ubuntu-latest
container:
image: emscripten/emsdk
steps:
- uses: actions/checkout#v3
- run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEMSCRIPTEN=ON
- run: cmake --build build --config ${{env.BUILD_TYPE}}
- uses: actions/upload-artifact#master
with:
name: page
path: build
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- uses: actions/download-artifact#master
with:
name: page
path: .
- uses: actions/configure-pages#v1
- uses: actions/upload-pages-artifact#v1
with:
path: .
- id: deployment
uses: actions/deploy-pages#main

Every step has already defined a uses or run key, but still receiving an error

GitHub Action keeps telling me the following error: every step must define a uses or run key I think I set the uses or run for each step already. What's the problem?
name: cci-api cicd
on: [push,pull_request]
jobs:
ci-enviroment-setup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout#v2
- name: Setup Python
uses: actions/setup-python#v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Setup Poetry
- run: |
python -m pip install -U pip
pip install poetry
poetry install
- name: Azure Login
- uses: Azure/login#v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure key vault - Get DB Secrets
uses: Azure/get-keyvault-secrets#v1
with:
keyvault: kv-prt-us-dev
secrets: prt-cet
As other pointed out, each step is required to have either run or uses key:
name: cci-api cicd
on: [push,pull_request]
jobs:
ci-enviroment-setup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout#v2
- name: Setup Python
uses: actions/setup-python#v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Setup Poetry
# removed - in front of run key
run: |
python -m pip install -U pip
pip install poetry
poetry install
- name: Azure Login
# removed - in front of uses key
uses: Azure/login#v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure key vault - Get DB Secrets
uses: Azure/get-keyvault-secrets#v1
with:
keyvault: kv-prt-us-dev
secrets: prt-cet

Github Actions Secrets: value not updating after changing it on Github UI

I have some github workflows using secrets in the repository.
I created the secret, but I used the wrong value for it so I went on the website again and updated the value to a different string.
It seems though that no matter what I do, the value doesn't change when the workflow is running. Outputting the value to the console shows the initial value that I set.
I even tried removing the secret and re-adding it with the new value, no success.
Any idea how to get it to change?
You probably forgot to pass the secrets on in the Actions yml
Changing this did the trick for me.
Adding them in the yaml file as env passes them on to the workflow
jobs:
run:
runs-on: ubuntu-latest
environment: publish
steps:
- uses: actions/checkout#v2
- name: Set up Python 3.9
uses: actions/setup-python#v2
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run
run: python publish.py
env:
URL: ${{ secrets.URL }}
USER: ${{ secrets.USER }}
PASS: ${{ secrets.PASS }}

How to deploy GitHub Action for my KMM project

Currently, I got some problems when I try to write the YAML file for deploying the GitHub action for KMM project. I don't know how to write the correct script (gradlew command) about testing the code of the shared module. Here's a part of my YAML file:
test_job:
name: Test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v2
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action#e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Restore Cache
uses: actions/cache#v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradle executable
run: chmod +x ./gradlew
- name: Run Debug Tests
run: ./gradlew testDebugUnitTest --continue
- name: Upload Test Reports
if: ${{ always() }}
uses: actions/upload-artifact#v2
with:
name: test-reports
path: '**/build/reports/tests/'
You can use:
./gradlew check to run tests for all your targets
./gradlew <targetName>Test to run it for a specific target
Note that probably you'd want to specify the shared module as well, for ex: ./gradlew :shared:check
For more information you could check out: https://kotlinlang.org/docs/mpp-run-tests.html#run-tests-for-one-or-more-targets